0

I am having issues connecting from a LAMP over to an DB2 iseries. Any thoughts on this code? I cannot get it to connect. How can I confirm that the iseries driver works, is installed, etc. Or is my code wrong? Thanks in advance...

   $db_name     = "mydatabase";
   $db_host        = "ip address";
   $db_user        = "user";
   $db_pass        = "mypass";
   $dsn =         "DRIVER={iSeries Access ODBC Driver};" . 
                  "CommLinks=tcpip(Host=$db_host);" . 
                  "DatabaseName=$db_name;" . 
                  "uid=$db_user; pwd=$db_pass";

   $odbc = odbc_connect($dsn, $db_user, $db_pass);

     if (!$db = odbc_connect ($dsn, $db_user, $db_pass)) echo 'Error!';
     else echo 'Success!';


     $res400 = odbc_columns($odbc, "mylibrary", "%", "myfile", "%") or die(odbc_errormsg());

     echo odbc_result_all($res400);
Greg Burris
  • 123
  • 3
  • 10
  • You'll need to explain what you mean by "having issues" and "cannot get it to connect". Is your computer turned on? If not, it could cause "issues" too. Do you have the DB2 Data Server Client installed? If so, what version? Do you have DB2 Connect installed? For now there isn't enough information to help you. – mustaccio Jun 19 '13 at 23:32
  • What errors are you getting? What version of IBM i (formerly OS/400, i5/OS) is the server running? What version & service pack of iSeries Access? – WarrenT Jun 20 '13 at 14:45
  • iSeries Access version should be >= IBM i version, and should have a service pack installed. Verify your database name, with sys admin, dba, or i developer, or via iSeries Navigator. Have you tried ODBC connections thru other means? – WarrenT Jun 20 '13 at 14:53

0 Answers0