Hey! Read again what I wrote ;-) I'm using the __DB2__ and the DSN is correct! What I don't understand I'm getting error from iODBC (yes, i found this message in libiodbc.so library, which is also installed on the system). But I want native DB2 connections from mod_perl application, so I'm confused with the ODBC message.
Native DB2 connections work without problems from console Perl applications. Miroslav On 09. Nov v 09:00, Martin J. Evans wrote: > I'm not that familiar with iODBC but the error is indicating it can't find > your > data source. What I don't understand is that if you are using ODBC (and it > looks as though you are given the error) then how is that 'dbi:DB2:as400tes" - > shouldn't it have been 'dbi:ODBC:as400tes'? How do you get an OBDC error from > the DB2 driver? Have you perhaps managed to catalog an ODBC data source into > DB2 a little like you can pull ODBC data into Oracle with hsODBC (heterogenous > services). > > Look in the iODBC documentation to see where it looks for your system data > sources or set the ODBCINI env var to point to your odbc.ini file. > > Martin > -- > Martin J. Evans > Easysoft Ltd, UK > Development > > > On 09-Nov-2004 Dan Scott wrote: > > On Mon, 8 Nov 2004 15:17:34 +0100, Miroslav Lau?? <[EMAIL PROTECTED]> wrote: > >> Hi all! > >> > >> I'm using DBD::DB2 to access remote DB2 database on an AS400 machine. I've > >> managed it to work from command line. > >> > >> But when trying to connect to remote database from a mod_perl application > >> the > >> $DBI::errstr is set to this: > >> > >> >[iODBC][Driver Manager]Data source name not found and no default driver > >> >specified. Driver could not be loaded > >> > >> What the hell is ODBC doing here? > >> > >> This is the source of the Mason component: > >> > >> -- DB2test.html > >> <%$DBI::errstr%> > >> > >> DB2DIR <%$ENV{'DB2DIR'}%><br> > >> DB2INSTANCE <%$ENV{'DB2INSTANCE'}%><br> > >> INSTHOME <%$ENV{'INSTHOME'}%><br> > >> CLASSPATH <%$ENV{'CLASSPATH'}%><br> > >> LD_LIBRARY_PATH <%$ENV{'LD_LIBRARY_PATH'}%><br> > >> LIBPATH <%$ENV{'LIBPATH'}%><br> > >> > >> <%INIT> > >> use DBI; > >> use DBD::DB2::Constants; > >> use DBD::DB2; > >> > >> my $loc = setlocale( LC_ALL, "cs_CZ" ); > >> > >> my $dbstr = "dbi:DB2:as400tes"; > >> my $dbuser = 'MLAUS'; > >> my $dbpasswd = 'MLAUS'; > >> > >> my $dbh = DBI->connect($dbstr, $dbuser, $dbpasswd); > >> > >> my $sql = "SELECT > >> SULNME,SUFNME FROM CABLEDTA.SUBSMSTR AS MAIN WHERE MAIN.SULNME LIKE 'LAU%' > >> ORDER BY MAIN.SULNME,MAIN.SUFNME ASC;"; > >> </%INIT> > >> > >> <%ARGS> > >> </%ARGS> > >> -- > >> > >> If I try to run the CLI version as normal CGI, it works. I'm sure the > >> environment is setup allright. > >> > >> I'm running Apache 1.3.28, mod_perl 1.28, HTML::Mason 1.05, DBI 1.45, > >> DBD::DB2 > >> 0.78. > >> > >> Miroslav Laus > >> > >> > > > > My guess is that mod_perl ignores the environment settings you have at > > the top of the Mason script; can you try setting the enviroment > > variables in your Apache startup script instead of within the Mason > > script? > > > > Dan