Heureka!

The problem lies in the mod_php4 which is compiled with ODBC support, and
somehow it turns out to load the ODBC driver instead of the DB2 one. Weird.
I'm using mod_php 4.3.3 on SuSE 9.0

Anyway, thanks to all who tried to help me.

Miroslav

On 08. Nov v 15:17, Miroslav Lauš 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
> 

Reply via email to