CodeIgniter Forums
Migration from CI3 to CI4 - SQLServer - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: Migration from CI3 to CI4 - SQLServer (/showthread.php?tid=79221)



Migration from CI3 to CI4 - SQLServer - Marcos Queiroz - 05-14-2021

I'm having difficulty configuring CI4 to connect to SQL Server. Undecided

I have the following configuration on CI3 that works perfectly:

PHP Code:
$db['ADMINBD04'] = array(
    
'dsn'    => '',
    
'hostname' => 'ADMINBD\NAME',
    
'username' => 'userci',
    
'password' => '#password123',
    
'database' => 'BASE',
    
'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
); 

I tried to replicate at CI without success.

.evn

Code:
database.default.hostname = ADMINBD\NAME
database.default.database = BASE
database.default.username = userci
database.default.password = #password123
database.default.DBDriver = SQLSRV
database.default.port = 1433

Or in the Configuration file.

PHP Code:
    public $default = [
        
'DSN'      => '',
        
'hostname' => 'ADMINBD\NAME',
        
'username' => 'userci',
        
'password' => '#password123',
        
'database' => 'BASE',
        
'DBDriver' => 'SQLSRV',
        
'DBPrefix' => '',
        
'pConnect' => false,
        
'DBDebug'  => (ENVIRONMENT !== 'production'),
        
'charset'  => 'utf8',
        
'DBCollat' => 'utf8_general_ci',
        
'swapPre'  => '',
        
'encrypt'  => false,
        
'compress' => false,
        
'strictOn' => false,
        
'failover' => [],
        
'port'     => 1433,
    ]; 

I don't know what I'm doing wrong, I thank you for your help. Huh


RE: Migration from CI3 to CI4 - SQLServer - Marcos Queiroz - 05-17-2021

I discovered the problem, the firewall of the connection of the new server with PHP8 raised by the infra was with the UDP protocol blocked.

After several tests comparing the old server with PHP7, we identified the problem.

But, again, I would like to congratulate you for your efforts to keep CodeIgniter simple and fantastic.


RE: Migration from CI3 to CI4 - SQLServer - includebeer - 05-17-2021

Thank you for sharing your solution!