CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Win32 Programming Help:
dbi error

 

First page Previous page 1 2 Next page Last page  View All


wayko621
Novice

May 10, 2002, 8:57 AM

Post #1 of 28 (16938 views)
dbi error Can't Post

i wrote a perl script that should access my database using odbc here is the coding



#!/usr/bin/perl

$first = $field{'first'};
$last = $field{'last'};
$address = $field{'address'};
$email = $field{'email'};
$phone = $field{'phone'};
$user = $field{'user'};
$pass = $field{'pass'};

use DBD;
$dbh = DBD->connect("DBD::ODBC::test.mdb");

print"<html><body><h1>this is a test</h1>";
$sql = qq{INSERT INTO Dreamcpu(FirstName,LastName,Address,Email,Phone,Username,Password) VALUES ('$first','$last','$adress','$email','$phone','$user','$pass');};

$rc = $dbh->do($sql);

print"$rc record(s) were added.<p>";

$sth = $dbh->prepare("SELECT ID,FirstName,LastName,Address,Email,Phone,Username,Password FROM Dreamcpu");
$sth->executive();


print"<table>\n";
print"<tr><th>ID</th><th>First</th><th>Last</th><th>Address</th><th>Email</th><th>Phone</th><th>User</th><th>Password</th>\n";
while (@row = $sth->fetchrow_array)
{
print"<tr>";
foreach(@row)
{
print"<td>$_</td>";
}
print"</tr>\n";
}
print"</table>\n";
print"</body></html>";

$sth->finish;
$dbh->disconnect;



when i goto the website and when i click the submit button

i get this error CGI Error

The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:



Can't locate object method "connect" via package "DBD" (perhaps you forgot to load "DBD"?) at C:\Inetpub\wwwroot\cgi-bin\database1.pl line 12.PirateMadFrown


fashimpaur
User

May 10, 2002, 11:10 AM

Post #2 of 28 (16936 views)
Re: [wayko621] dbi error [In reply to] Can't Post

Well, first thing I see is that you do not print a valid CGI header.

Before any text can be printed to the browser, the following print
statement must be sent to STDOUT:

print "Content-Type: text/html\n\n";

I will continue to look at your script. I sense there is more wrong,
but this was the first thing that leapt out at me.
Dennis

$a="c323745335d3221214b364d545".
"a362532582521254c3640504c3729".
"2f493759214b3635554c3040606a0",
print unpack"u*",pack "h*",$a,"\n\n";


wayko621
Novice

May 10, 2002, 12:19 PM

Post #3 of 28 (16932 views)
Re: [fashimpaur] dbi error [In reply to] Can't Post

i updated the code to this



#!/usr/bin/perl

$first = $field{'first'};
$last = $field{'last'};
$address = $field{'address'};
$email = $field{'email'};
$phone = $field{'phone'};
$user = $field{'user'};
$pass = $field{'pass'};

use DBI;
$dbh = DBI->connect("dbi:ODBC:'driver=Driver do Microsoft Access (*.mdb)
dbq=test.mdb'");

print "Content-Type: text/html\n\n";
print"<html><body><h1>this is a test</h1>";
$sql = qq{INSERT INTO Dreamcpu(FirstName,LastName,Address,Email,Phone,Username,Password) VALUES

('$first','$last','$adress','$email','$phone','$user','$pass');};

$rc = $dbh->do($sql);

print"$rc record(s) were added.<p>";

$sth = $dbh->prepare("SELECT ID,FirstName,LastName,Address,Email,Phone,Username,Password FROM Dreamcpu");
$sth->executive();


print"<table>\n";
print"<tr><th>ID</th><th>First</th><th>Last</th><th>Address</th><th>Email</th><th>Phone</th><th>User</th><th>Password</th>\n"

;
while (@row = $sth->fetchrow_array)
{
print"<tr>";
foreach(@row)
{
print"<td>$_</td>";
}
print"</tr>\n";
}
print"</table>\n";
print"</body></html>";

$sth->finish;
$dbh->disconnect;

still same error PirateUnsureMadFrown


fashimpaur
User

May 10, 2002, 12:38 PM

Post #4 of 28 (16930 views)
Re: [wayko621] dbi error [In reply to] Can't Post

wayko,

Add the following two lines at the top of the script:

use CGI;
use CGI::Carp 'fatalsToBrowser';

It should print out any problems detected to your browser window.

I will be back later to check on your progress.
Dennis

$a="c323745335d3221214b364d545".
"a362532582521254c3640504c3729".
"2f493759214b3635554c3040606a0",
print unpack"u*",pack "h*",$a,"\n\n";


wayko621
Novice

May 10, 2002, 12:41 PM

Post #5 of 28 (16927 views)
Re: [fashimpaur] dbi error [In reply to] Can't Post

i added that 2 file

iran the page i get this error

Software error:Can't locate object method "connect" via package "DBI" (perhaps you forgot to load "DBI"?) at C:\Inetpub\wwwroot\cgi-bin\database1.pl line 14.

For help, please send mail to this site's webmaster, giving this error message and the time and date of the error.


fashimpaur
User

May 10, 2002, 12:47 PM

Post #6 of 28 (16925 views)
Re: [wayko621] dbi error [In reply to] Can't Post

Is DBI loaded on server? Is DBD::ODBC loaded on server? Is server Win32 machine? Can you use Win32::ODBC module instead? Do some discovery on these and I will check back later this evening if I have a chance, else tomorrow.
Dennis

$a="c323745335d3221214b364d545".
"a362532582521254c3640504c3729".
"2f493759214b3635554c3040606a0",
print unpack"u*",pack "h*",$a,"\n\n";


wayko621
Novice

May 10, 2002, 12:50 PM

Post #7 of 28 (16922 views)
Re: [fashimpaur] dbi error [In reply to] Can't Post

i used ppm to install dbi and dbd:odbc

i am using windows xp as my server


Paul
Enthusiast

May 11, 2002, 3:38 PM

Post #8 of 28 (16918 views)
Re: [wayko621] dbi error [In reply to] Can't Post

Hmm there are quite a few errors such as:

$sth->executive();

I think you mean $sth->execute() Smile

http://www.perlmonks.com/index.pl?node=Site%20How%20To


(This post was edited by RedRum on May 11, 2002, 3:42 PM)


wayko621
Novice

May 16, 2002, 5:06 AM

Post #9 of 28 (16907 views)
Re: [RedRum] dbi error [In reply to] Can't Post

well i got a bit further

i re-installed active perl

and dbi

and dbd-odbc

now i get a new error that make me happy :)

this is a test

Content-type: text/html Software error:Can't call method "do" on an undefined value at C:\Inetpub\wwwroot\cgi-bin\database1.pl line 21.

For help, please send mail to this site's webmaster, giving this error message and the time and date of the error.

here is the new coding

use CGI;
use CGI::Carp 'fatalsToBrowser';
#!/usr/bin/perl

$first = $field{'first'};
$last = $field{'last'};
$address = $field{'address'};
$email = $field{'email'};
$phone = $field{'phone'};
$user = $field{'user'};
$pass = $field{'pass'};

use DBI;
$dbh = DBI->connect("dbi:ODBC:'driver = Driver do Microsoft Access(*.mdb);
dbq=test.mdb'");

print "Content-Type: text/html\n\n";
print"<html><body><h1>this is a test</h1>";
$sql = qq{INSERT INTO Dreamcpu (FirstName,LastName,Address,Email,Phone,Username,Password) VALUES

('$first','$last','$adress','$email','$phone','$user','$pass');};

$rc = $dbh->do($sql);

print"$rc record(s) were added.<p>";

$sth = $dbh->prepare("SELECT * FROM Dreamcpu");
$sth->execute();


print"<table>\n";
print"<tr><th>ID</th><th>First</th><th>Last</th><th>Address</th><th>Email</th><th>Phone</th><th>User</th><th>Password</th>\n"

;
while (@row = $sth->fetchrow_array)
{
print"<tr>";
foreach(@row)
{
print"<td>$_</td>";
}
print"</tr>\n";
}
print"</table>\n";
print"</body></html>";

$sth->finish;
$dbh->disconnect;


(This post was edited by wayko621 on May 16, 2002, 5:31 AM)


fashimpaur
User

May 16, 2002, 6:18 AM

Post #10 of 28 (16903 views)
Re: [wayko621] dbi error [In reply to] Can't Post

Okay, this message essentially means that the $dbh object was not created
(no connection made to DB). Try this:

$dbh = DBI->connect("dbi:ODBC:'driver = Driver do Microsoft Access(*.mdb);
dbq=test.mdb'") || die "Can't connect to database: $DBI::errstr";



Also, why aren't you doing a $sth = $dbh->prepare($sql); and
a $rc = $sth->execute();? Just wondering this...

Let us know what you find.
Dennis

$a="c323745335d3221214b364d545".
"a362532582521254c3640504c3729".
"2f493759214b3635554c3040606a0",
print unpack"u*",pack "h*",$a,"\n\n";


wayko621
Novice

May 16, 2002, 9:05 AM

Post #11 of 28 (16897 views)
Re: [fashimpaur] dbi error [In reply to] Can't Post

the book didnt show that

$sth = $dbh->prepare($sql);

$rc = $sth->execute();


they showed

$rc=$dbh->do($sql);



$sth=$dbh->prepare("select * from table1");

$sth->execute();



i made the changes

new code is

use CGI;
use CGI::Carp 'fatalsToBrowser';
#!/usr/bin/perl

$first = $field{'first'};
$last = $field{'last'};
$address = $field{'address'};
$email = $field{'email'};
$phone = $field{'phone'};
$user = $field{'user'};
$pass = $field{'pass'};

use DBI;
$dbh = DBI->connect("dbi:ODBC:'driver = Driver do Microsoft Access(*.mdb);
dbq=test.mdb'")|| die "Can't connect to database: $DBI::errstr";

print "Content-Type: text/html\n\n";
print"<html><body><h1>this is a test</h1>";
$sql = qq{INSERT INTO Dreamcpu (FirstName,LastName,Address,Email,Phone,Username,Password) VALUES

('$first','$last','$adress','$email','$phone','$user','$pass');};

print"$rc record(s) were added.<p>";

$sth = $dbh->prepare($sql);
$rc = $sth->execute();


print"<table>\n";
print"<tr><th>ID</th><th>First</th><th>Last</th><th>Address</th><th>Email</th><th>Phone</th><th>User</th><th>Password</th>\n"

;
while (@row = $sth->fetchrow_array)
{
print"<tr>";
foreach(@row)
{
print"<td>$_</td>";
}
print"</tr>\n";
}
print"</table>\n";
print"</body></html>";

$sth->finish;
$dbh->disconnect;


this is the new error Software error:Can't connect to database: [Microsoft][ODBC Driver Manager] Invalid string or buffer length (SQL-S1090)(DBD: db_login/SQLConnect err=-1) at C:\Inetpub\wwwroot\cgi-bin\database1.pl line 14.

For help, please send mail to this site's webmaster, giving this error message and the time and date of the error.


(This post was edited by wayko621 on May 16, 2002, 9:16 AM)


fashimpaur
User

May 16, 2002, 9:40 AM

Post #12 of 28 (16894 views)
Re: [wayko621] dbi error [In reply to] Can't Post

Wayko,

Upon further inspection, I am not sure your connection is correctly formatted.

Can you try something like this:


Code
 my $DSN = 'driver=Microsoft Access Driver (*.mdb);dbq=\\\\server\\driveletter$\\full\\path\\to\\test.mdb'; 
# use the server portion only if it is on a different machine.
# drive letter is followed by dollar sign '$'
# substitute remaining path info as appropriate to point to .mbd file
my $dbh = DBI->connect("dbi:ODBC:$DSN", '','') || die "Can't connect to database: $DBI::errstr";

See what this does for you. Will look for your post back.
Dennis

$a="c323745335d3221214b364d545".
"a362532582521254c3640504c3729".
"2f493759214b3635554c3040606a0",
print unpack"u*",pack "h*",$a,"\n\n";


wayko621
Novice

May 16, 2002, 10:39 AM

Post #13 of 28 (16892 views)
Re: [fashimpaur] dbi error [In reply to] Can't Post

new code

use CGI;
use CGI::Carp 'fatalsToBrowser';
#!/usr/bin/perl -w


$first = $field{'first'};
$last = $field{'last'};
$address = $field{'address'};
$email = $field{'email'};
$phone = $field{'phone'};
$user = $field{'user'};
$pass = $field{'pass'};


use DBI;
my $DSN = 'driver=Driver do Microsoft Access (*.mdb);
dbq=\\$c\\Inetpub\\wwwroot\\test.mdb';
DBI->trace(5,"c:/trace.txt");
my $dbh = DBI->connect("dbi:ODBC:$DSN", '','') || die "Can't connect to database: $DBI::errstr";



print "Content-Type: text/html\n\n";
print"<html><body><h1>this is a test</h1>";
$sql = qq{INSERT INTO Dreamcpu (FirstName,LastName,Address,Email,Phone,Username,Password) VALUES


('$first','$last','$adress','$email','$phone','$user','$pass');};

print"$rc record(s) were added.<p>";

$sth = $dbh->prepare($sql);
$rc = $sth->execute();



print"<table>\n";
print"<tr><th>ID</th><th>First</th><th>Last</th><th>Address</th><th>Email</th><th>Phone</th><th>User</th><th>Password</th>\n"


;
while (@row = $sth->fetchrow_array)
{
print"<tr>";
foreach(@row)
{
print"<td>$_</td>";
}
print"</tr>\n";
}
print"</table>\n";
print"</body></html>";


$sth->finish;
$dbh->disconnect;



i added the lines plus added a dbi->trace
the file came out with this


DBI 1.21-nothread dispatch trace level set to 5
Note: perl is running without the recommended perl -w option
-> DBI->connect(dbi:ODBC:driver=Microsoft Access Driver (*.mdb);
dbq=\$c\inetpub\wwwroot\test.mdb, , ****)
-> DBI->install_driver(ODBC) for MSWin32 perl=5.006001 pid=3056 ruid=0 euid=0
install_driver: DBD::ODBC version 0.28 loaded from C:/Perl/site/lib/DBD/ODBC.pm
New DBI::dr (for DBD::ODBC::dr, parent=, id=)
dbih_setup_handle(DBI::dr=HASH(0x18070ec)=>DBI::dr=HASH(0x17b5cd8), DBD::ODBC::dr, 0, Null!)
dbih_make_com(Null!, DBD::ODBC::dr, 92)
dbih_setup_attrib(DBI::dr=HASH(0x17b5cd8), Err, Null!) SCALAR(0x1552ee0) (already defined)
dbih_setup_attrib(DBI::dr=HASH(0x17b5cd8), State, Null!) SCALAR(0x17c0dd4) (already defined)
dbih_setup_attrib(DBI::dr=HASH(0x17b5cd8), Errstr, Null!) SCALAR(0x17c0d98) (already defined)
dbih_setup_attrib(DBI::dr=HASH(0x17b5cd8), Handlers, Null!) ARRAY(0x17b5c54) (already defined)
dbih_setup_attrib(DBI::dr=HASH(0x17b5cd8), Debug, Null!) 0 (already defined)
dbih_setup_attrib(DBI::dr=HASH(0x17b5cd8), FetchHashKeyName, Null!) 'NAME' (already defined)
<- install_driver= DBI::dr=HASH(0x18070ec)
-> connect for DBD::ODBC::dr (DBI::dr=HASH(0x18070ec)~0x17b5cd8 'driver=Microsoft Access Driver (*.mdb);
dbq=\$c\inetpub\wwwroot\test.mdb' '' **** HASH(0x182ed84))





i still got the error Software error:Can't connect to database: [Microsoft][ODBC Driver Manager] Invalid string or buffer length (SQL-S1090)(DBD: db_login/SQLConnect err=-1) at C:\Inetpub\wwwroot\cgi-bin\database1.pl line 16.



UnsurePirateFrownUnimpressed


(This post was edited by wayko621 on May 16, 2002, 11:07 AM)


fashimpaur
User

May 16, 2002, 11:17 AM

Post #14 of 28 (16886 views)
Re: [wayko621] dbi error [In reply to] Can't Post

Does your database require a username and password? Those should be in the
DSN if it does.

Try again and let me know.
Dennis

$a="c323745335d3221214b364d545".
"a362532582521254c3640504c3729".
"2f493759214b3635554c3040606a0",
print unpack"u*",pack "h*",$a,"\n\n";


wayko621
Novice

May 16, 2002, 11:58 AM

Post #15 of 28 (16884 views)
Re: [fashimpaur] dbi error [In reply to] Can't Post

i redid the code

use CGI;
use CGI::Carp 'fatalsToBrowser';
#!/usr/bin/perl -w

$first = $field{'first'};
$last = $field{'last'};
$address = $field{'address'};
$email = $field{'email'};
$phone = $field{'phone'};
$user = $field{'user'};
$pass = $field{'pass'};

use DBI;
$dbh = DBI->connect("dbi:ODBC:'driver = Driver do Microsoft Access(*.mdb);
dbq=test.mdb'",admin,wayko621) || die "Can't connect to database: $DBI::errstr";


print "Content-Type: text/html\n\n";
print"<html><body><h1>this is a test</h1>";
$sql = qq{INSERT INTO Dreamcpu (FirstName,LastName,Address,Email,Phone,Username,Password) VALUES

('$first','$last','$adress','$email','$phone','$user','$pass');};

print"$rc record(s) were added.<p>";

$sth = $dbh->prepare($sql);
$rc = $sth->execute();


print"<table>\n";
print"<tr><th>ID</th><th>First</th><th>Last</th><th>Address</th><th>Email</th><th>Phone</th><th>User</th><th>Password</th>\n"

;
while (@row = $sth->fetchrow_array)
{
print"<tr>";
foreach(@row)
{
print"<td>$_</td>";
}
print"</tr>\n";
}
print"</table>\n";
print"</body></html>";

$sth->finish;
$dbh->disconnect;



quick question

do i set the file on ODBC on the userDSN or system dsn


fashimpaur
User

May 16, 2002, 12:03 PM

Post #16 of 28 (16882 views)
Re: [wayko621] dbi error [In reply to] Can't Post

With this method of connection, you do not need a DSN entry in the ODBC
wizard. Also, I note that your $DSN value should be:


Code
 my $DSN = 'driver=Microsoft Access Driver (*.mdb);  
dbq=\\c$\\Inetpub\\wwwroot\\test.mdb';


Try again and let me know.

Got my fingers crossed now,
Dennis

$a="c323745335d3221214b364d545".
"a362532582521254c3640504c3729".
"2f493759214b3635554c3040606a0",
print unpack"u*",pack "h*",$a,"\n\n";


wayko621
Novice

May 16, 2002, 12:16 PM

Post #17 of 28 (16879 views)
Re: [fashimpaur] dbi error [In reply to] Can't Post

well we are progressing

this is a test

record(s) were added.

Content-type: text/html Software error:Can't call method "prepare" on an undefined value at C:\Inetpub\wwwroot\cgi-bin\database1.pl line 24.

For help, please send mail to this site's webmaster, giving this error message and the time and date of the error.


(This post was edited by wayko621 on May 16, 2002, 12:18 PM)


fashimpaur
User

May 16, 2002, 12:29 PM

Post #18 of 28 (16877 views)
Re: [wayko621] dbi error [In reply to] Can't Post

Well, this still implies that $dbh is not connected to the database. Try again with trace on. See what your output is. Good Luck. I will be back again tomorrow.

See your posts then,
Dennis

$a="c323745335d3221214b364d545".
"a362532582521254c3640504c3729".
"2f493759214b3635554c3040606a0",
print unpack"u*",pack "h*",$a,"\n\n";


wayko621
Novice

May 16, 2002, 12:38 PM

Post #19 of 28 (16875 views)
Re: [fashimpaur] dbi error [In reply to] Can't Post

DBI 1.21-nothread dispatch trace level set to 5
Note: perl is running without the recommended perl -w option
-> DBI->connect(dbi:ODBC:driver=Driver do Microsoft Access (*.mdb);
dbq=\c$\Inetpub\wwwroot\test.mdb, , ****)
-> DBI->install_driver(ODBC) for MSWin32 perl=5.006001 pid=2416 ruid=0 euid=0
install_driver: DBD::ODBC version 0.28 loaded from C:/Perl/site/lib/DBD/ODBC.pm
New DBI::dr (for DBD::ODBC::dr, parent=, id=)
dbih_setup_handle(DBI::dr=HASH(0x18070ec)=>DBI::dr=HASH(0x17b5ce4), DBD::ODBC::dr, 0, Null!)
dbih_make_com(Null!, DBD::ODBC::dr, 92)
dbih_setup_attrib(DBI::dr=HASH(0x17b5ce4), Err, Null!) SCALAR(0x1552ee0) (already defined)
dbih_setup_attrib(DBI::dr=HASH(0x17b5ce4), State, Null!) SCALAR(0x17c0dd4) (already defined)
dbih_setup_attrib(DBI::dr=HASH(0x17b5ce4), Errstr, Null!) SCALAR(0x17c0d98) (already defined)
dbih_setup_attrib(DBI::dr=HASH(0x17b5ce4), Handlers, Null!) ARRAY(0x17b5c60) (already defined)
dbih_setup_attrib(DBI::dr=HASH(0x17b5ce4), Debug, Null!) 0 (already defined)
dbih_setup_attrib(DBI::dr=HASH(0x17b5ce4), FetchHashKeyName, Null!) 'NAME' (already defined)
<- install_driver= DBI::dr=HASH(0x18070ec)
-> connect for DBD::ODBC::dr (DBI::dr=HASH(0x18070ec)~0x17b5ce4 'driver=Driver do Microsoft Access (*.mdb);
dbq=\c$\Inetpub\wwwroot\test.mdb' '' **** HASH(0x182ed84))



does that make any sense?



also

my $dbh = DBI->connect("dbi:ODBC:$DSN", '','') || die "Can't connect to database: $DBI::errstr";

do i put the password like this>

my $dbh = DBI->connect("dbi:ODBC:$DSN", admin,wayko621) || die "Can't connect to database: $DBI::errstr";


wayko621
Novice

May 17, 2002, 5:27 AM

Post #20 of 28 (16863 views)
Re: [wayko621] dbi error [In reply to] Can't Post

Can't connect to database: [Microsoft][ODBC Driver Manager] Invalid string or buffer length (SQL-S1090)(DBD: db_login/SQLConnect err=-1) at C:\Inetpub\wwwroot\cgi-bin\database1.pl line 16.is there an ADO for dbi?is there a way to change the buffer length?


fashimpaur
User

May 17, 2002, 8:18 AM

Post #21 of 28 (16856 views)
Re: [wayko621] dbi error [In reply to] Can't Post

Well, again I still think your Definition of $DSN is wrong. It should not be:

Code
  my $DSN = "driver=Driver do Microsoft Access (*.mdb);dbq=\\c$\\Inetpub\\wwwroot\\test.mdb";  

It should be:

Code
  my $DSN = "driver= Microsoft Access Driver(*.mdb);dbq=\\c$\\Inetpub\\wwwroot\\test.mdb";  


As for the connect call, it should use your user name and password like this:


Code
  my $dbh = DBI->connect("dbi:ODBC:$DSN", "admin", "wayko621");  

Your trace should not, I am pretty sure, contain the line:


Quote
-> connect for DBD::ODBC::dr (DBI::dr=HASH(0x18070ec)~0x17b5ce4 'driver=Driver do Microsoft Access (*.mdb);
dbq=\c$\Inetpub\wwwroot\test.mdb' '' **** HASH(0x182ed84))



Make sure you have the dsn and connect statement as shown above.

Run the trace again and see what you get.
Dennis

$a="c323745335d3221214b364d545".
"a362532582521254c3640504c3729".
"2f493759214b3635554c3040606a0",
print unpack"u*",pack "h*",$a,"\n\n";


(This post was edited by fashimpaur on May 17, 2002, 8:19 AM)


wayko621
Novice

May 17, 2002, 8:25 AM

Post #22 of 28 (16852 views)
Re: [fashimpaur] dbi error [In reply to] Can't Post

well i am having a bit of a problem with the microsoft access driver

they only give me some french options

so that where the Driver do Microsoft Access comes from

i did it in Mysql but the data wont go anywhere and i get and error when i try to export the database to the Mysql server


wayko621
Novice

May 20, 2002, 8:29 AM

Post #23 of 28 (16833 views)
Re: [wayko621] dbi error [In reply to] Can't Post

i re-installed evertything

windows xp

office xp

active perl

dbi

dbd-odbc

still the same error Software error:Can't connect to database: [Microsoft][ODBC Driver Manager] Invalid string or buffer length (SQL-S1090)(DBD: db_login/SQLConnect err=-1) at c:\inetpub\wwwroot\cgi-bin\database1.pl line 16.

For help, please send mail to this site's webmaster, giving this error message and the time and date of the error.


fashimpaur
User

May 20, 2002, 8:57 AM

Post #24 of 28 (16832 views)
Re: [wayko621] dbi error [In reply to] Can't Post

Wayko,

Pls post your current code in database1.pl again so we are all on the same track here.

Thanks,
Dennis

$a="c323745335d3221214b364d545".
"a362532582521254c3640504c3729".
"2f493759214b3635554c3040606a0",
print unpack"u*",pack "h*",$a,"\n\n";


wayko621
Novice

May 20, 2002, 9:01 AM

Post #25 of 28 (16830 views)
Re: [fashimpaur] dbi error [In reply to] Can't Post

use CGI;
use CGI::Carp 'fatalsToBrowser';
#!/usr/bin/perl -w

$first = $field{'first'};
$last = $field{'last'};
$address = $field{'address'};
$email = $field{'email'};
$phone = $field{'phone'};
$user = $field{'user'};
$pass = $field{'pass'};

use DBI;
$DSN = 'driver=Microsoft Access Driver (*.mdb);
dbq=\\$c\\inetpub\\wwwroot\\DreamCpu.mdb';
my $dbh = DBI->connect("dbi:ODBC:$DSN", '','') || die "Can't connect to database: $DBI::errstr";




print "Content-Type: text/html\n\n";
print"<html><body><h1>this is a test</h1>";
$sql = qq{INSERT INTO Dreamcpu (FirstName,LastName,Address,Email,Phone,Username,Password) VALUES ('$first','$last','$adress','$email','$phone','$user','$pass');};

print"$rc record(s) were added.<p>";

$sth = $dbh->prepare($sql);
$rc = $sth->execute();


print"<table>\n";
print"<tr><th>ID</th><th>First</th><th>Last</th><th>Address</th><th>Email</th><th>Phone</th><th>User</th><th>Password</th>\n";
while (@row = $sth->fetchrow_array)
{
print"<tr>";
foreach(@row)
{
print"<td>$_</td>";
}
print"</tr>\n";
}
print"</table>\n";
print"</body></html>";

$sth->finish;
$dbh->disconnect;


which version of dbd-odbc do you have on your computer i tried updating to dbd-odbc 0.41 it was said that that might help with the error

and i put the file on here so u can try it on your end
Attachments: database1.pl (1.14 KB)
  DreamCpu.mdb (132 KB)

First page Previous page 1 2 Next page Last page  View All
 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives