【问题标题】:Laravel dosen't connect with OracleLaravel 不与 Oracle 连接
【发布时间】:2015-03-08 15:22:17
【问题描述】:

我正在使用 yajra/laravel-oci8 与 laravel 进行 Oracle 连接。但我无法连接到 Oracle,从我的客户端 PC 到服务器。

显示此错误:

我在 database.php 中使用此代码:

'oracle' => array(
       'driver' => 'oracle',
       'host' => '192.168.152.189',// this is my server IP
       'port' => '1521',
       'database' => 'ocp',
       'username' => 'ocpl',
       'password' => '123456',
       'charset' => 'AL32UTF8',
       'prefix' => '',
       'port' => 1521
  ),

但我与 Sql Developer 有联系。 查看 Sql-Developer 属性:

【问题讨论】:

  • SQL Developer 中的 SID 与配置中的数据库名称不匹配。
  • 将数据库更改为 orcl
  • 但是我可以在哪里提供 SID。 @Mat
  • 我试过这个'orcl'作为数据库,但没有连接。 @米海
  • 您还定义了两次“端口”!我不确定那会做什么?

标签: php laravel laravel-4 oracle11g oracle-sqldeveloper


【解决方案1】:

这一行的问题:'database' => 'ocp' , 解决它:'database' => 'orcl' ,

'数据库' => '192.168.152.189/orcl'

【讨论】:

    【解决方案2】:

    试试这个

    'oracle' => array(
           'driver' => 'oracle',
           'tns' => '(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.152.189)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = orcl)))',
           //'host' => '192.168.152.189',// this is my server IP
           //'port' => '1521',
           'database' => '',
           'username' => 'ocpl',
           'password' => '123456',
           'charset' => 'AL32UTF8',
           'prefix' => '',
    ),
    

    【讨论】:

      【解决方案3】:

      虽然这个问题是在将近三年后发布的...... 但我只是用这种方式来解决这个问题

      在 oracle 中搜索这个命令

      Select instance_name from v$instance;
      

      然后将值粘贴到“数据库”设置中

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-04-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-03-25
        • 1970-01-01
        相关资源
        最近更新 更多