Laravel dosen't connect with Oracle

懵懂的女人 提交于 2019-12-06 09:26:19

问题


I'm using yajra/laravel-oci8 for Oracle connection with laravel. But I couldn't connected to Oracle, from my client PC to Server.

showing this error:

I'm using this code in 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
  ),

But I'm connected with Sql Developer. see the Sql-Developer Property:


回答1:


problem in this line : 'database' => 'ocp' , solve it with : 'database' => 'orcl' , or

'database' => '192.168.152.189/orcl'




回答2:


Try this

'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:


Although this question has been posted after almost three year... but I just use this way to solve this problem

search this command in oracle

Select instance_name from v$instance;

then paste the value into 'database' setting



来源:https://stackoverflow.com/questions/27875241/laravel-dosent-connect-with-oracle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!