Forum Moderators: coopster
I need to make a DSN-less connection to DB2 using ODBC and I was wondering if the code below is right? Although it looks fine to me, I'm getting the following error "Error [IBM][CLI Driver] SQL1013N The database alias name or database name "" could not be found. SQLSTATE=42705 : 08001".
<?php
$connection_string = 'DRIVER={IBM DB2 ODBC DRIVER};SERVER=<servername>;DATABASE=<databasename>';
$user = 'username';
$pass = 'password';
$connection = odbc_connect( $connection_string, $user, $pass );
?>
Have I got the various fields for $connection_string right? Any sort of help would be appreciated. Cheers.
$dsn = 'DRIVER={iSeries Access ODBC Driver};SYSTEM=MYSYSTEM;';would work. Have you tried ibm.com/db2 to find the API's and more particulary the ODBC connection string syntax for your particular platform? One thing that looks funny to me is the less than and greater than symbols in your connection parms.