[unixODBC-support] unixODBC & ibmDB2

Jud Bishop judson.bishop at eamc.org
Mon May 29 17:31:44 BST 2006


Ralf,

Here is a simple as400 connect in perl that will set up tracing and
should give you some more insight.  You'll have to flesh it out for more
testing.

The user has allobj and jobctl authority but nothing special on DB2 that
I know of...

Jud

#!/usr/bin/perl
use DBI;

# Connect to DB
my $dbh = DBI->connect ( "dbi:ODBC:$DSN", $UID, $PW, {PrintError => 1})
        or die "connection failed to database $DBI::errstr\n";

# Set up tracing
# This should only do something when you add prepare, execute,
# fetch and disconnect.
unlink '/tmp/trace.log' if -e '/tmp/trace.log';
DBI->trace( 2, '/tmp/trace.log' );


my $sql_st = $dbh->prepare( "SELECT * FROM DB" );


$sql_st->execute()
        or die "Cannot execute SQL statement $DBI::errstr\n";

# Retrieve data
my @row;
while ( @row = $sql_st->fetchrow_array() )
{
        print "@row\n";
}
warn "Data fetch terminated by error $DBI::errstr\n"
        if $DBI::err;

# Disconnect
$dbh->disconnect or warn "disconnection failed $DBI::errstr\n";

exit();



On Mon, 2006-05-29 at 10:34 -0500, Ralf Schmitt wrote:
> Hi Jud
> 
> thanks for your ini files. I merged them with my config 
> and tested with 
> 
> ralf at inspiron:~$ isql -v sample 
> [08004][unixODBC][IBM][iSeries Access ODBC-Treiber]Fehler bei  
> Datenübertragungsverbindung. comm rc=10061 - CWBCO1049 -  
> iSeries-Serveranwendung  wurde nicht gestartet 
> [ISQL]ERROR: Could not SQLConnect
> 
> (CWBCO1049 Cause: The server was contacted, but refused the
> connection  
> request.)
> 
> but 
> 
> ralf at inspiron:~$ /opt/ibm/iSeriesAccess/bin/cwbping /port:50000
> inspiron
> 
> IBM iSeries Access for Linux 
> Version 5  Release 2  Stufe 0 
> Programm zum Überprüfen von Verbindungen 
> (C) Copyright IBM Corporation and Others 1984, 2003. All rights
> reserved. 
> U.S. Government Users Restricted Rights - Use, duplication or
> disclosure 
>   restricted by GSA ADP Schedule Contract with IBM Corp. 
> Licensed Materials - Property of IBM
> 
> Mit der Tastenkombination STRG-C oder STRG-UNTBR können Sie die
> Anforderung  
> CWBPING abbrechen 
> I - Verbindung zu System INSPIRON wird überprüft... 
> I - Verbindung zu Serveranwendung #50000 wurde erfolgreich
> hergestellt 
> I - Verbindung zu System INSPIRON überprüft
> 
> which says that everything works fine!
> 
> do you have any debugging hints for me? maybe there is something I
> need to  
> tell db2 that odbc-remote-connections are allowed??? 
> 
> regards 
> 
> ralf
> 
> 
> 
> Am Montag, 29. Mai 2006 16:42 schrieb Jud Bishop: 
> > Ralf, 
> > 
> > Here is the pertinent stuff for odbcinst.ini: 
> > [iSeries Access ODBC Driver] 
> > Description             = iSeries Access for Linux ODBC Driver 
> > Driver          = /opt/ibm/iSeriesAccess/lib/libcwbodbc.so 
> > Setup           = /opt/ibm/iSeriesAccess/lib/libcwbodbcs.so 
> > Threading               = 2 
> > DontDLClose             = 1 
> > UsageCount              = 1 
> > 
> > 
> > Here is the pertinent stuff from odbc.ini: 
> > [AS400] 
> > Description             = iSeries Access ODBC Driver 
> > Driver          = iSeries Access ODBC Driver 
> > System          = system.whatever.org 
> > UserID          = userid 
> > Password                = password 
> > Naming          = 0 
> > DefaultLibraries                = QGPL 
> > Database                = 
> > ConnectionType          = 0 
> > CommitMode              = 2 
> > ExtendedDynamic         = 1 
> > DefaultPkgLibrary               = QGPL 
> > DefaultPackage          = A/DEFAULT(IBM),2,0,1,0,512 
> > AllowDataCompression            = 1 
> > LibraryView             = 0 
> > AllowUnsupportedChar            = 0 
> > ForceTranslation                = 0 
> > Trace           = 1 
> > DSN             = AS400 
> > 
> > 
> > Hope this helps. 
> > 
> > Jud Bishop 
> > 
> > On Mon, 2006-05-29 at 08:44 -0500, Ralf Schmitt wrote: 
> > > Hello list, 
> > > 
> > > i'm writing a tool in c which should connect an ibm AS400 db2 via 
> > > tcp/ip from 
> > > an linux system. 
> > > 
> > > - I've setup a test environment with db2 v8.2 and unixodbc 2.2.1
> on 
> > > the same 
> > > machine. 
> > > 
> > > - My odbc.ini file looks like this 
> > > [sample] 
> > > Description = DB2 Sample DB 
> > > Driver = DB2-1 
> > > 
> > > - My odbcinst.ini like this 
> > > [DB2-1] 
> > > Description             = db2 test driver 
> > > Driver          = /home/db2inst1/sqllib/lib/libdb2.so 
> > > FileUsage               = 1 
> > > DontDLClose             = 1 
> > > 
> > > As you can see I use libdb2.so from the database installation
> itself. 
> > > This 
> > > setup works cause 
> > > isql -v sample 
> > > connects! And my tool works as it should. 
> > > 
> > > But how can I connect to a remote db2 via tcpip (db not on 
> > > localhost)? 
> > > http://www.unixodbc.org/doc/db2.html 
> > > says nothing about it! 
> > > 
> > > I've also tried the actual iSeriesAccess package from IBM with
> this 
> > > [DB2-2] 
> > > Description             = iSeries Access for Linux ODBC Driver 
> > > Driver          = /opt/ibm/iSeriesAccess/lib/libcwbodbc.so 
> > > Setup           = /opt/ibm/iSeriesAccess/lib/libcwbodbcs.so 
> > > Threading               = 2 
> > > DontDLClose             = 1 
> > > 
> > > but now isql doesn't connect the db with this driver! Hope there
> is 
> > > any help 
> > > out there. 
> > > 
> > > Thanks for reading. 
> > > 
> > > ralf 
> > > 
> > > _______________________________________________ 
> > > unixODBC-support mailing list 
> > > unixODBC-support at easysoft.com 
> > > http://mail.easysoft.com/mailman/listinfo/unixodbc-support 
> > > 
> > > 
> > > Confidentiality Notice:  This e-mail message, including any 
> > > attachments, is for the sole use of the intended recipient(s) and
> may 
> > > contain confidential and privileged information.  Any
> unauthorized 
> > > review, use, disclosure or distribution is prohibited.  If you are
> not 
> > > the intended recipient, please contact the sender by reply e-mail
> and 
> > > destroy all copies of the original message. 
> > 
> > _______________________________________________ 
> > unixODBC-support mailing list 
> > unixODBC-support at easysoft.com 
> > http://mail.easysoft.com/mailman/listinfo/unixodbc-support
> 
> _______________________________________________ 
> unixODBC-support mailing list 
> unixODBC-support at easysoft.com 
> http://mail.easysoft.com/mailman/listinfo/unixodbc-support
> 
> 
> Confidentiality Notice:  This e-mail message, including any
> attachments, is for the sole use of the intended recipient(s) and may
> contain confidential and privileged information.  Any unauthorized
> review, use, disclosure or distribution is prohibited.  If you are not
> the intended recipient, please contact the sender by reply e-mail and
> destroy all copies of the original message. 
> 
> 





More information about the unixODBC-support mailing list