爲什麼從Codeigniter 3.0 PHP連接時SQL Server @@ spid與所有會話相同?Codeiginiter SQLServer連接是否會一直存在?從Codeigniter for MSSQL連接可以建立非持久連接
我已成功從Codeigniter 3.0.2連接到SQL Server。我正在使用sqlserv驅動程序。 爲什麼SQL Server @@ spid總是爲不同的用戶會話返回相同的值。
我的數據庫連接沒有設置爲Persist。我如何使它不會持續下去。這是我的數據庫連接。
$db['default'] = array(
'dsn' => '',
'hostname' => '127.0.0.1',
'username' => 'user',
'password' => 'password',
'database' => 'Testdb',
'dbdriver' => 'sqlsrv',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
我試着從codeigniter的Mysql連接相同。它的工作原理與預期一致。 ?
你意識到你這樣做會讓你的應用程序變得更慢嗎? :) – Mjh
@Mjh。謝謝,我發佈了我的答案後意識到,通過使我沒有有效地使用連接池。這是一個測試,我正在理解連接池:)。 – srp