Welcome Guest, Not a member yet? Register   Sign In
CI 1.6.1, Database Class, Manually Connecting, Passing an array of values
#1

[eluser]Unknown[/eluser]
Hi everyone.

I was trying to connect manually to a database by passing an array of values, with the database configuration.

Example:

Code:
$config['hostname'] = "//solap/oracle";
$config['username'] = "environmentdw";
$config['password'] = "password";
$config['database'] = "oracle";
$config['dbdriver'] = "oci8";
$config['dbprefix'] = "";
$config['pconnect'] = FALSE;
$config['db_debug'] = TRUE;
$config['active_r'] = FALSE;

$this->load->database($config);

This kept me showing the following error: You have not selected a database type to connect to.

I digged into the system/database/DB.php file and realized that the load->database($config) was being interpreted as a DSN string.

I solved this issue by adding the following line
Code:
if(!is_array($params))
before line 28
Code:
if (is_string($params) AND strpos($params, '://') === FALSE)

I don't know if it's a bug.
Keep up the good work.
#2

[eluser]Derek Jones[/eluser]
Thanks Zebra, this has been recently fixed in the svn.




Theme © iAndrew 2016 - Forum software by © MyBB