CodeIgniter Forums

Full Version: CodeIgniter and SQL Server
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello ,
First of all, sniff me for my english.
I programmed a local application that works correctly with CodeIgniter 4.
The development environment is as follows:
- Apache 2.4.33
- PHP 7.0.29 Thread safe
- SQL Server 2014
During the test deployment I meet the following error:
A Database Error Occurred
Unable to connect to your database using the provided settings.
Filename: ... system / database / DB_driver.php
Line Number: 436
I did the connection tests to SQL Server and everything works fine.
But as soon as I pass on CodeIgniter there is a mistake.
The test environment is as follows:
- Plesk
- IIS
- PHP 7.0 No Thread safe
- SQL Server 2014
Thanks for your help.
Are you sure it's CodeIgniter 4? v4 doesn't have a database driver for SQL Server yet, so that could be the problem.
Escuse me, it's CodeIgniter 3 .
(07-27-2018, 08:57 AM)kilishan Wrote: [ -> ]Are you sure it's CodeIgniter 4? v4 doesn't have a database driver for SQL Server yet, so that could be the problem.

[quote pid='356082' dateline='1532707038']
[off-topic]
When using CI4 is it possible to use the PHP NameSpace Class statement to utilise the CI 3.19 Database Drivers? 

CI3.19 Database Drivers are tried, tested and thoroughly debugged and hopefully should integrate with CI4 without a great deal of modifications.

Also if the CI 3.19 Database Drivers were included into CI4 then far more users will be able to test and report their findings.

 I have my fingers crossed Smile

[/off-topic]
[/quote]
This is my database configuration with MSSQL server 1014.
If you using the express edition don't forget the SQLEXPRESS in the hostname!

Goog luck

Code:
$db['default'] = array(
    'dsn'    => '',
    'hostname' => 'LAPTOP-EDDOH\SQLEXPRESS',
    'port' => '1433',
    'username' => 'YOUR_USERNAME',
    'password' => 'YOUR_PASSOWORD',
    'database' => 'YOUR-DATABASENAME',
    '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