Welcome Guest, Not a member yet? Register   Sign In
building a dsn for use with CI

(This post was last modified: 04-12-2020, 06:51 AM by richb201.)

I am trying to connect via a dsn to a remote database. I am confused as to how to build the dsn.

From php.net

$dsn 'mysql:host=localhost;dbname=testdb';
$username 'username';
$password 'password';
$options = array(

$dbh = new PDO($dsn$username$password$options);

from the CI manual pages:
$dsn = 'dbdriver://username:password@hostname/database';

I have connected to this databse via psql on the command line with:
psql --host=imagesdatabase.cwymdn16xxxes.us-east-1.rds.amazonaws.com --port=5432 --username=richb2 --password --dbname=postgres

How do I go from my working psql version above to the CI example? 

I tried this but I am getting a 500 error from the load database command below, which mean invalid driver
$dsn = 'jdbc:postgresql://imagesdatabase.cwymdn16xxxes.us-east-1.rds.amazonaws.com:5432/postgres -Urichb2';
$DB1 = $this->load->database($dsn, TRUE);
proof that an old dog can learn new tricks

Theme © iAndrew 2016 - Forum software by © MyBB