Home  >  Article  >  Database  >  ThinkPHP 连接Oracle的配置写法,(使用Oci扩展而非PDO的写法)

ThinkPHP 连接Oracle的配置写法,(使用Oci扩展而非PDO的写法)

WBOY
WBOYOriginal
2016-06-07 15:24:241475browse

测试了很多遍,TP官网根本就没有给出正确的写法,而且网上搜索到的全都是错误的。 跟踪代码,最终找出了正确的配置写法,备份如下,(by default7#zbphp.com) DB_TYPE = oracle, // 数据库类型 DB_HOST = oracle.zbphp.com, // 服务器地址 DB_NAME = (DESCR

测试了很多遍,TP官网根本就没有给出正确的写法,而且网上搜索到的全都是错误的。

跟踪代码,最终找出了正确的配置写法,备份如下,(by default7#zbphp.com)


    'DB_TYPE'            => 'oracle', // 数据库类型
    'DB_HOST'            => 'oracle.zbphp.com', // 服务器地址
    'DB_NAME'            => '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle.zbphp.com)(PORT=1029))(CONNECT_DATA=(SID=orcl)))', // 服务器地址
    'DB_USER'            => 'zbphp', // 用户名
    'DB_PWD'             => 'fuzb', // 密码
    'DB_PORT'            => 1029, // 端口
    'DB_PREFIX'          => 'TB_', // 数据库表前缀
    'DB_CHARSET'         => 'utf8', // 字符集
    'DB_PARAMS'          => array(
        'persist' => true, //注意,这一个必须写
    ),


来源: http://blog.csdn.net/default7/article/details/38332609

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