![]() |
building a dsn for use with CI - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: building a dsn for use with CI (/showthread.php?tid=76065) |
building a dsn for use with CI - richb201 - 04-12-2020 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 <?php $dsn = 'mysql:host=localhost;dbname=testdb'; $username = 'username'; $password = 'password'; $options = array( PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8', ); $dbh = new PDO($dsn, $username, $password, $options); ?> from the CI manual pages: $dsn = 'dbdriver://username:[email protected]/database'; $this->load->database($dsn); 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); |