Home  >  Article  >  Backend Development  >  thinkphp连接oracle数据库

thinkphp连接oracle数据库

WBOY
WBOYOriginal
2016-06-23 13:40:39940browse

我把php.in中的extension=php_oci8.dll前面的注释去掉了,而db.php中的连接串也改了
return array(
'DB_TYPE'=>'Oracle',
'DB_HOST'=>'192.168.22.245',
'DB_PORT'=>'1521',
'DB_NAME'=>'ZHS16GBK.llsoft',
'DB_USER'=>'test',
'DB_PWD'=>'test',
'DB_PREFIX'=>'thinkphp_',
);
可是这样怎么都连接不上。


回复讨论(解决方案)

打开的think的错误追踪工具,看看

1、Oracle8 以上需要安装 Oracle 客户端,请确认确已安装了
2、你这个数据库名称(ZHS16GBK.llsoft)好奇怪呀
      一般的说 ZHS16GBK 是字符集
3、数据库名处应该是Oracle 的侦听名(Oracle 中侦听名与数据库名可以相同,也可以不相同)

'DB_TYPE'               =>  'oracle',     // 数据库类型
    'DB_HOST'               =>  'localhost', // 服务器地址
    'DB_NAME'               =>  'ORCL',          // 数据库名
    'DB_USER'               =>  '',      // 用户名
    'DB_PWD'                =>  '',          // 密码
    'DB_PORT'               =>  '1521',        // 端口

'DB_TYPE'               =>  'oracle',     // 数据库类型
    'DB_HOST'               =>  'localhost', // 服务器地址
    'DB_NAME'               =>  'ORCL',          // 数据库名
    'DB_USER'               =>  '',      // 用户名
    'DB_PWD'                =>  '',          // 密码
    'DB_PORT'               =>  '1521',        // 端口




我的连接上啦

'DB_TYPE'               =>  'oracle',     // 数据库类型
    'DB_HOST'               =>  'localhost', // 服务器地址
    'DB_NAME'               =>  'ORCL',          // 数据库名
    'DB_USER'               =>  '',      // 用户名
    'DB_PWD'                =>  '',          // 密码
    'DB_PORT'               =>  '1521',        // 端口


这个我也可以,主要是我那个项目就是不能支持oracle,不过分还是给你了
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn