0

I am using CodeIgniter framework for my application. I need to connect another hosting databse with my application. I have tried as like below but didn't work.

$db['intermediate_db']['hostname'] = '45.116.113.98,41433';
$db['intermediate_db']['username'] = 'sa';
$db['intermediate_db']['password'] = '';
$db['intermediate_db']['database'] = 'logimax';
$db['intermediate_db']['dbdriver'] = 'mssql';
$db['intermediate_db']['pconnect'] = FALSE;
$db['intermediate_db']['db_debug'] = TRUE;
$db['intermediate_db']['cache_on'] = FALSE;
$db['intermediate_db']['autoinit'] = TRUE;
$db['intermediate_db']['stricton'] = FALSE;


$common_db = $this->load->database('intermediate_db', TRUE);
$status    = $common_db->insert('scheme_transaction', $data);

I have given the correct credentials only in my config file but showing the error like

A Database Error Occurred Unable to connect to your database server using the provided settings Filename: core/Loader.php

Line Number: 1015

I have confirmed with my hosting person can connect another hsoting server by using IP and port number. And also I have enabled mssql extension and checked in php info file also. Could you please help anyone to solve my issue.

NikuNj Rathod
  • 1,663
  • 1
  • 17
  • 26
Vinoth Kumar
  • 489
  • 3
  • 17
  • 45

1 Answers1

0

Use the port key in database.php.

$db['intermediate_db']['port'] = 41433;

$db['intermediate_db']['hostname'] = '45.116.113.98';
$db['intermediate_db']['port'] = 41433;
$db['intermediate_db']['username'] = 'sa';
$db['intermediate_db']['password'] = '';
$db['intermediate_db']['database'] = 'logimax';
$db['intermediate_db']['dbdriver'] = 'mssql';
$db['intermediate_db']['pconnect'] = FALSE;
$db['intermediate_db']['db_debug'] = TRUE;
$db['intermediate_db']['cache_on'] = FALSE;
$db['intermediate_db']['autoinit'] = TRUE;
$db['intermediate_db']['stricton'] = FALSE;
Bryan Bojorque
  • 168
  • 1
  • 11