惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

云风的 BLOG
云风的 BLOG
Security Archives - TechRepublic
Security Archives - TechRepublic
V
Vulnerabilities – Threatpost
C
CXSECURITY Database RSS Feed - CXSecurity.com
P
Proofpoint News Feed
G
GRAHAM CLULEY
P
Privacy International News Feed
The Hacker News
The Hacker News
Forbes - Security
Forbes - Security
U
Unit 42
N
News and Events Feed by Topic
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
Cyber Attacks, Cyber Crime and Cyber Security
C
Cisco Blogs
A
About on SuperTechFans
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
D
Docker
I
Intezer
Spread Privacy
Spread Privacy
The Last Watchdog
The Last Watchdog
V2EX - 技术
V2EX - 技术
S
Security @ Cisco Blogs
F
Full Disclosure
S
Secure Thoughts
M
MIT News - Artificial intelligence
Microsoft Security Blog
Microsoft Security Blog
G
Google Developers Blog
aimingoo的专栏
aimingoo的专栏
W
WeLiveSecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Project Zero
Project Zero
Recorded Future
Recorded Future
Cyberwarzone
Cyberwarzone
S
Security Affairs
AWS News Blog
AWS News Blog
H
Help Net Security
The GitHub Blog
The GitHub Blog
Hacker News: Ask HN
Hacker News: Ask HN
Vercel News
Vercel News
P
Proofpoint News Feed
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
The Register - Security
The Register - Security
S
Schneier on Security
F
Fortinet All Blogs
C
CERT Recently Published Vulnerability Notes
L
LINUX DO - 最新话题
T
Tor Project blog
T
The Exploit Database - CXSecurity.com
MongoDB | Blog
MongoDB | Blog
Webroot Blog
Webroot Blog

博客园 - myx

安装gitlab管理自己的代码 升级Tornado到4后weibo oauth登录不了 SQL Server 无日志文件附加数据库 用monit监控系统关键进程 Failed to read auto-increment value from storage engine错误的处理方法 今天测试了一下 sqlalchemy 性能 PIL The _imaging C module is not installed phpExcel大数据量情况下内存溢出解决 tcpdf慢及常用的一些方法及问题 Python获取WebService CodeIgniter出现Disallowed Key Characters的问题 用python写windows服务 CodeIgniter链接ms sql 的过程windows 2008 关于NTLM认证的.NET,php,python登录 DotNetOpenAuth的Facebook登录,获取头像与基本资料 php里的html内容切取 js生成新加坡的NRIC号码 Sina站内应用的登录 PowerDesigner 链接MySql 用ODBC链接不上的问题
CodeIgniter链接ms sql 如果数据库名称有点号连接出错
myx · 2013-04-02 · via 博客园 - myx

CodeIgniter链接ms sql 如果数据库名称有点号连接出错,提示如下:
注连接方式是: sqlsrv 

A Database Error Occurred

Unable to select the specified database: dbabo.ceb

Filename: D:\Project\xxxx\Code\system\database\DB_driver.php

连接的其他数据没问题。在这里就遇到了。一时不得其解。想想是不是数据库名有"."点号引起的呢。测试吧.点好修改成_链接成功。 但数据是第三方给的。没办法修改他们的数据库名称。就只好自己找问题了。先是在database.php里修改成$db['msdb']['database'] = '[dbabo.ceb]' 等,都测试不行。看来只好看代码了。

最后修改如下就可以解决:

打开\system\database\drivers\sqlsrv_driver.php文件,找到db_select()方法。修改如下:

    /**
     * Select the database
     *
     * @access    private called by the base class
     * @return    resource
     */
    function db_select()
    {
        #修改后的
        return $this->_execute('USE [' . $this->database .']');
        #以前的
        #return $this->_execute('USE ' . $this->database);
    }

然后测试就可以了。 是在这里如果有点好。 用 USE dbname会报错。