0

I just installed an iSeriesODBC-5.1.0-0.16.i386.rpm on my ubuntu linux 12.04 32bit OS. What im trying to do is connect to a DB2 AS400.

When I run this code below:

<?php 

$JDALIB = 'MMMMMM';

$DSN = "DRIVER=iSeries Access ODBC Driver;SYSTEM=dev_ip;DBQ=$JDALIB";
$connect = odbc_connect($DSN, "USERNAME", "PASSWORD", SQL_CUR_USE_IF_NEEDED);

gave me an

PHP Warning:  odbc_connect(): SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect in /home/odbc_connection.php on line 6

So what i did was to install unixODBC and freeTDS and I did install them successfully but when I run again my connection script. Still same error result. Can anyone help me.

user2720708
  • 455
  • 2
  • 8
  • 19

1 Answers1

0

Not sure why you would install freeTDS, thats to connect to SQL Server or Sybase.

Also, not sure where DBQ is from, that looks more like a MS Access connection attribute.

You could try

$DSN = "DRIVER={iSeries Access ODBC Driver};HOSTNAME=dev_ip;Database=$JDALIB";

But I would try and get it working with isql first, there are docs on the unixODBC site that describe getting DB2 connections working.

I would try to create a DSN and get that working before trying to use a DSN less connection as you are doing.

Have a read of http://www.unixodbc.org/doc/db2.html

Nick Gorham
  • 1,118
  • 8
  • 9