db_initiate error

I'm using CS Cart 4.0.2 and I'm getting an error calling db_initiate within a custom func.php script.



Ooops!



An error occurred



I double checked my connection variables (database name, user name, password, etc.) so it doesn't seem to be an authentication error. Here's the string I'm using:



db_initiate('localhost', 'root', 'MYPASSWORD', 'webdb1', 'sng', 'ra_');



Anyone have any ideas where this could be getting tripped up?

Looking for a workaround, I tried to connect to the secondary database since it uses the same login/password as the database I'm using for CS Cart and it's on the same localhost. So CS-Cart is running on webdb2 and my existing database is webdb1.



This query works inside CS Cart:


$data = db_query("SELECT * FROM webdb1.mytable LIMIT 5;");



Yes! However, when I try to do an insert using the same database.table reference, I get the error again.



$query_data = array("user_id" => "123");
db_query('INSERT INTO webdb1.ra_subs_record ?e', $query_data);




Ooops!



An error occurred



I'm sure there is some type of security reason this is happening so ideally I could get db_initiate to work correctly. [The secondary database is used by another application so I can't place both tables in the same database.]