Welcome Guest, Not a member yet? Register   Sign In
Connect to Remote SQL Server
#1

(This post was last modified: 05-19-2022, 02:59 AM by aussenseiter.)

Hello guys, this is my first post in the forum..
I have problem with an existing project build with CI 3. So, I'm trying to connect this project from my local computer to remote SQL Server using this configuration.

PHP Code:
$db['mssql'] = array(
  'dsn'          => '',
  'hostname' => '[xxx.xx.xxx.xx]',
  'port' => 1433,
 
'username' => 'dbusername',
 
'password' => 'dbpassword',
 
'database' => 'project_database',
  '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' => FALSE
); 
I've tested those configuration using SMSS and it connected just fine. But in Codeigniter, it always throw "Unable to connect to your database server using the provided settings." error. I cant find any decent example how to config database to Remote SQL Server. 
Can anyone here help give some pointers or any example to help fix this problem?
Reply
#2

Finally solved it after long stressfull hours. It turns out I installed an old ODBC driver that's not compatible with MSSQL on remote database server. So, all I need to do is re-install latest ODBC driver and everything finally work as expected.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB