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

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

 1 2  View All Print Thread

wayko621
Novice

May 22, 2002, 7:27 AM

Post #26 of 28 (5027 views)
 Re: [wayko621] dbi error [In reply to] Can't Post
no post :(

i think this isn't meant to be

i guess i have to try coldfusion or something else i know

i was hoping to be able to do it this way but :(

INS
New User

Aug 28, 2002, 7:49 PM

Post #27 of 28 (4710 views)
 Re: [wayko621] dbi error [In reply to] Can't Post
This might be late, and I'm still new at Perl and DBI, but the only error I see is at the begining and the end of the following cut and paste code:

\$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>";

Shouldn't \$adress in the variable passed be \$address, like declaired in the begining?

thebitch
User

Aug 29, 2002, 3:43 AM

Post #28 of 28 (4708 views)
 Re: [wayko621] dbi error [In reply to] Can't Post
I think that DSN there is wrong.
I personally never used DSN's like that.
As per the reccomendation of the DBD::ODBC
pod, I like to set up a system DSN
using the ODBC manager under win32

on win2000, it's (just file find for odbc*.cpl)
start > run > odbccp32.cpl

anyway, what I think the DSN should be is

 Code
` my \$DSN = "dbi:ODBC:"; \$DSN .= "Driver={Microsoft Access Driver (*.mdb)};"; \$DSN .= "Dbq=c:\somepath\mydb.mdb;"; \$DSN .= "Uid=admin;Pwd=;"; # just in case u need it`
It is a very common error to forget the {} part in
Driver={}

Anyway, that should solve your problem.
Don't think that I remembered this (i've used it before),
but what I did was search google.com
for ODBC DSN and came up with