I am new to Perl and trying to access a database using JDBC.  I have
installed MySQL on a box running Linux which is hosting the target DB.
 I am running on W2K using ActiveState's Perl.  I have installed the
JDBC driver for MySQL on the W2K machine and can access the target DB
using this driver and Java.

I installed DBD::JDBC, the JDBC proxy driver for DBI.  Per the
documentation I started the JDBC server app using the following batch
file -

echo "Starting DBD::JDBC Server"

>>
@echo off
rem  This batch file starts DBD::JDBC server
set
CLASSPATH=%CLASSPATH%;d:\Perl\lib\mm.mysql-2.0.11-bin.jar;d:\Perl\lib\dbd_jd
bc.jar
set DRIVERS=org.gjt.mm.mysql.Driver
start java -Djdbc.drivers=%DRIVERS% -Ddbd.port=9001
-Ddbd.trace=abusive com.vizdom.dbd.jdbc.Server
>>


This app appears to start OK and spits out a message - "Accepting
Connections".

I then run the following script to try and connect to the JDBC driver
-

>>
use DBI;

print "Connecting to DBD::JDBC\n";


        
        $user = "abcd";
        $password = "xyz0";
        $dsn =
"dbi:JDBC:hostname=localhost:9001;url=org.gjt.mm.mysql.Driver:DBName:10.0.0.
10:3306";
        $dbh = DBI->connect($dsn, "abcd", "xyz0", 
          { PrintError => 0, RaiseError => 1, });

exit 0;
>>
and get the following:

>>
Connecting to DBD::JDBC
SV = RV(0x1a99788) at 0x262bafc
  REFCNT = 1
  FLAGS = (ROK)
  RV = 0x262bb74
SV = RV(0x1a99788) at 0x140fd5c
  REFCNT = 1
  FLAGS = (ROK,READONLY)
  RV = 0x262bb74
DBD::JDBC initialisation failed:
dbih_setup_attrib(DBI::dr=HASH(0x262bb74)): Fet
chHashKeyName not set and no parent supplied at D:/Perl/lib/DBI.pm
line 657.
        (in cleanup) dbih_getcom handle DBI::dr=HASH(0x262bb74) is not
a DBI han
dle (has no magic) at D:/Perl/lib/DBI.pm line 481.
        (in cleanup) dbih_getcom handle DBI::dr=HASH(0x262bb74) is not
a DBI han
dle (has no magic) at D:/Perl/lib/DBI.pm line 482.
>>

I have tried accesing the DBD::mySQL directly as follows:

>>
# This script connects to DBD::mySQL

use DBI;
use strict;

        print "Connecting to DBD::MySQL\n";

        DBI->trace(4, "trace.log");
        print "Issuing Connect command\n";
        my $host = '10.0.0.38';
        my $user = 'visitor';
        my $password = 'swdev';
        my $database = 'NetAttend';
        my $port=3306;
        my $dsn = "DBI:mysql:$database:$host:$port";
        my $dbh = DBI->connect($dsn, $user, $password);
                        
        

exit 0;

>>

and get the following in the log file:

>>

    DBI 1.201-nothread dispatch trace level set to 4
    -> DBI->connect(DBI:mysql:NetAttend:10.0.0.38:3306, visitor, swdev)
    -> DBI->install_driver(mysql) for perl=5.006001 pid=668 ruid=0 euid=0
       install_driver: DBD::mysql loaded (version 2.0400)
    New DBI::dr (for DBD::mysql::dr, parent=, id=)
    dbih_setup_handle(DBI::dr=HASH(0x1df774c)=>DBI::dr=HASH(0x1aaa13c),
DBD::mysql::dr, 0, Null!)
    dbih_make_com(Null!, DBD::mysql::dr, 84)
    -> DBI::END
    <- DBI::END complete
>>

I have no clue what this is and have not been able to solve this.

Any ideas/suggestions ?

Thanks for your help.

RM.

Reply via email to