At 18:59 -0700 4/15/02, Rakesh Mahajan wrote:
>Copied exactly from the perldoc DBD::MySQL I used
>
>>>
>
>use DBI;
>
>
> my $dbh = DBI->connect("DBI:myswql:NetAttend:10.0.0.38", "visitor",
>"swdev",{RaiseError => 1})
"DBI:myswql"??? Try "DBI:mysql" instead...
> or die "Failed to connect: ($DBI::err)
>$DBI::errstr\n";
>>>
>
>and that resulted in
>
>>>
>SV = RV(0x1a912f0) at 0x1db68a8
> REFCNT = 1
> FLAGS = (ROK)
> RV = 0x1db6914
> (in cleanup) dbih_getcom handle DBI::dr=HASH(0x1db6914) is not a DBI
>han
>dle (has no magic) at D:/Perl/lib/DBI.pm line 481.
>SV = RV(0x1a912f0) at 0x140fd5c
> REFCNT = 1
> FLAGS = (ROK,READONLY)
> RV = 0x1db6914
> (in cleanup) dbih_getcom handle DBI::dr=HASH(0x1db6914) is not a DBI
>han
>dle (has no magic) at D:/Perl/lib/DBI.pm line 482.
>DBD::mysql initialisation failed:
>dbih_setup_attrib(DBI::dr=HASH(0x1db6914)): Fe
>tchHashKeyName not set and no parent supplied at D:/Perl/lib/DBI.pm line
>657.
> (in cleanup) dbih_getcom handle DBI::dr=HASH(0x1db6914) 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(0x1db6914) is not a DBI
>han
>dle (has no magic) at D:/Perl/lib/DBI.pm line 482.
>
>>>
>
>What am I missing ? I'd really like to get beyond this.
>
>Rakesh.
>
>> -----Original Message-----
>> From: Sterin, Ilya [mailto:[EMAIL PROTECTED]]
>> Sent: Monday, April 15, 2002 6:39 PM
>> To: 'Rakesh Mahajan'; [EMAIL PROTECTED]
>> Subject: RE: Perl and MySQL
>>
>>
>> Look at your connect string and then carefully read perldoc
>> DBD::MySQL.
>> (hint)
>>
>> Ilya
>>
>> > -----Original Message-----
>> > From: Rakesh Mahajan [mailto:[EMAIL PROTECTED]]
>> > Sent: Monday, April 15, 2002 4:09 PM
>> > To: '[EMAIL PROTECTED]'
>> > Subject: Perl and MySQL
>> >
>> >
>> > 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:\P
>> > erl\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.
>> >
>>