>
>
> 1. I am doing everything in my notebook with win2000 and I log on as
> administrator.   Apache is started by "apache -f myhttpd.conf -k start".
> Does this mean that the user running apache service is administrator?  I
> have checked the DBD::ODBC doc and got no more clues except for defining a
> system DSN which I have done.

Note that I haven ot worked with apache 2.x yet, so what I say is pretty
specific to apache 1.3.  Mostly under unix, too, rather than Windows...
That said: IF you start apache from the command line, then yes, it should be
running as your user (if you start it as a service in the "Services" applet,
then check what it says for the user.  If you rely upon environment
variable,s apache doesn't pass the environment to the child processes (not
sure if your are using 2.x and threads or 1.x and "forked" processes).
Anyway, from the connect string below, I don't see that you are using
environment variables, so that's probably not it.

Try to use CGI::Carp to get the error message, just to verify what it says
or log the error message to a file when running under the cgi environment.
Just to make sure what the error message is when trying to connect via the
web.

>
> 2. The perl I use is also Activeperl build 633.  I have no idea why I
> cannot install dbd::odbc succesfully.

I don't know.  It might be a flag in the ppd file, but the ppd is generated
by MakeMaker directly.  It also says, in the ppd file, that the architecture
is <ARCHITECTURE NAME="MSWin32-x86-multi-thread" />

Can you verify you are getting that particular ppd by specifying the
full-path on the install line?

>
> Thanks a lot for your patience in dealing with this kind of Most
> Frequently
> Asked Question !

NP, but you should probably cross-post to dbi-users (which I did here) as
you will get a more broad level of support.  I don't know everything :)

Jeff

> ----- Original Message -----
> From: "Jeff Urlwin" <[EMAIL PROTECTED]>
> To: "Liu Haifeng" <[EMAIL PROTECTED]>; "Jeff Urlwin"
> <[EMAIL PROTECTED]>
> Sent: Thursday, August 29, 2002 6:47 PM
> Subject: RE: Failure of ODBC connection with Access
>
>
> > > Hi Jeff,
> > >
> > > Now I am trying to let my code working as a cgi script.  The
> web server
> > > (apache) is running locally at the same machine. The code failed
> > > to connect
> > > to the database again (using system DSN which works in the
> command line
> > > enviornment).  The snippet is the same as the earlier one:
> > > .....
> > > my $dbn="newgene";
> > > my $dbh=DBI->connect("dbi:ODBC:$dbn",'','')|| die
> "err:$DBI::errstr\n";
> > >
> > > my $cur=$dbh->prepare('select name from clients');
> > > print  "there are $cur->{NUM_OF_FIELDS} fields \n";
> > > $cur->execute();
> > > while (my @row =$cur->fetchrow){
> > >     print "$row[0] \n";
> > > }
> > > $dbh->disconnect();
> >
> > Is apache running as a service?  If so, check who the user running the
> > service is.  If it's LOCALSYSTEM (the default), then you get no
> access to
> > network shares.  If you are on a domain, it probably needs to
> be a domain
> > user (although you can make it a local user and work out the
> permissions,
> > it's MUCH easier to make it a domain user.  Some of this is described in
> the
> > PERL FAQ and DBD::ODBC's POD (from the command line, perldoc DBD::ODBC)
> >
> > > .....
> > >
> > > I have checked the archive of the mailinglist and found one similar
> case.
> > > As you suggested, I download the updated dbi.ppd and dbd-odbc.ppd from
> > > ftp.esoftmatic.com/outgoing/DBI/.   However, I failed to install
> > > dbd-odbc.ppd while dbi.ppd was successfully installed using
> ppm.  When I
> > > type "ppm install dbd-odbc.ppd", it says:
> > >
> > > Installing package 'dbd-odbc.ppd' ...
> > > Error installing package 'dbd-odbc.ppd': Read a PPD fro
> > > 'dbd-odbc.ppd', but
> > > it is not intended for this build of Perl (MSWin32-x86-multi-thread)
> > >
> > > Does this mean that I have to reinstall my perl with another version
> (the
> > > current one is v5.6.1 for MSWin32-x86-multi-thread)?
> >
> > I built that with ActivePerl 633, I think.  Please check which
> version you
> > are running.
> >
> > Regards,
> >
> > Jeff
> > >
> > > Regards
> > > Haifeng
> > > ----- Original Message -----
> > > From: "Jeff Urlwin" <[EMAIL PROTECTED]>
> > > To: "Liu Haifeng" <[EMAIL PROTECTED]>; "Jeff Urlwin"
> > > <[EMAIL PROTECTED]>
> > > Sent: Thursday, August 29, 2002 11:03 AM
> > > Subject: RE: Failure of ODBC connection with Access
> > >
> > >
> > > > To verify: the system DSN worked, so we are down to looking at the
> > > DSN-less
> > > > connection, right?
> > > >
> > > > I'll presume this is from the command line rather than from a web
> server
> > > or
> > > > service of some sort, right (the service/web server environment
> > > *usually*
> > > > causes issues).
> > > >
> > > > A few things come to mind:
> > > > 1) As I recall, the bug in DBD::ODBC 0.28 when connecting with
> > > a DSN-less
> > > > connection string was that the error message became invalid
> > > string buffer
> > > or
> > > > length, which hid the real connect problem.
> > > >
> > > > 2) The space in the path name may or may not be causing a
> problem.  It
> > > > shouldn't, off hand, but I'm *always* skeptical about those darn
> spaces
> > > > since too many things parse on whitespace.
> > > >
> > > > 3) Try upgrading to the latest DBD::ODBC and DBI.  If you
> have MSVC 6,
> > > then
> > > > build them yourself (usually best).  If you don't and you are using
> > > > ActiveState's perl 630+, then use ActiveState's PPM program to
> > > install the
> > > > PPD files that I have made available at
> > > >
> > > > ftp://ftp.esoftmatic.com/pub/outgoing/DBI
> > > >
> > > > Download the files and install locally...that should, at least,
> > > give you a
> > > > better error message.
> > > >
> > > > If that's not feasible, I'd try to copy the db locally to some
> > > simple path
> > > > such as c:\newgene.mdb and see if that fixes the issue.  That
> > > elminates a
> > > > lot of potential issues.
> > > >
> > > > Regards,
> > > >
> > > > Jeff
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Liu Haifeng [mailto:[EMAIL PROTECTED]]
> > > > > Sent: Wednesday, August 28, 2002 10:52 PM
> > > > > To: Jeff Urlwin
> > > > > Subject: Re: Failure of ODBC connection with Access
> > > > >
> > > > >
> > > > > You are definitely correct!  It is just due to my carelessness!
> > > > > But if I use
> > > > > my $dbn="driver=Microsoft Access Driver
> (*.mdb);dbq=\\\\genethon\\data
> > > > > drive\\www\\DB\\newgene.mdb";
> > > > > instead of the System DSN,  the error still presents.  The
> > > messages are:
> > > > > DBI->connect(driver=Microsoft Access Driver
> > > (*.mdb);dbq=\\genethon\data
> > > > > drive\www\DB\gnewgene.mdb) failed: [Microsoft][ODBC Driver
> > > > > Manager] Invaild
> > > > > string or buffer length (SQL-S1090) (DBD: db_login/SQLConnect
> > > err=-1) at
> > > > > testdb.pl line 22
> > > > > [Microsoft][ODBC Driver Manager] Invaild string or buffer length
> > > > > (SQL-S1090)
> > > > > (DBD: db_login/SQLConnect err=-1)
> > > > >
> > > > > Haifeng
> > > > > ----- Original Message -----
> > > > > From: "Jeff Urlwin" <[EMAIL PROTECTED]>
> > > > > To: "Liu Haifeng" <[EMAIL PROTECTED]>; "Jeff Urlwin"
> > > > > <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> > > > > Sent: Thursday, August 29, 2002 10:40 AM
> > > > > Subject: RE: Failure of ODBC connection with Access
> > > > >
> > > > >
> > > > > > Something must be wrong with the DSN you setup for this
> database,
> if
> > > the
> > > > > > first error message is right.
> > > > > >
> > > > > > Ahh -- I see it now.  It's much more obvious and subtle than
> > > > > any of that.
> > > > > >
> > > > > > When using '' instead of "", $dsn is not referenced as
> a variable.
> > > E.g.
> > > > > > my $dsn="foo";
> > > > > > print '$dsn'; #prints $dsn
> > > > > > vs.
> > > > > > print "$dsn"; #prints foo
> > > > > >
> > > > > > Jeff
> > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Liu Haifeng [mailto:[EMAIL PROTECTED]]
> > > > > > > Sent: Wednesday, August 28, 2002 10:34 PM
> > > > > > > To: Jeff Urlwin; [EMAIL PROTECTED]
> > > > > > > Subject: Re: Failure of ODBC connection with Access
> > > > > > >
> > > > > > >
> > > > > > > Answers to your questions:
> > > > > > > 1. Error messages (testdb.pl is the name of my program):
> > > > > > >     DBI->connect($dbn) failed: [Microsoft][ODBC
> Driver Manager]
> > > > > > > Data source
> > > > > > > name not found and no default driver specified
> > > > > > > <SQL-IM002><DBD:db-login/SQLConnect err=-1> at
> testdb.pl line 22
> > > > > > >     [Microsoft][ODBC Driver Manager] Data source name not
> > > found and
> > > no
> > > > > > > default driver specified
> > > <SQL-IM002><DBD:db-login/SQLConnect err=-1>
> > > > > > >
> > > > > > > 2. Microsoft Access Driver  version: 4.00.5353.01
> > > > > > > 3.  I login in to my PC as administaitor and the database file
> > > > > > > was built by
> > > > > > > myself.
> > > > > > >
> > > > > > > Regards
> > > > > > > Haifeng
> > > > > > > ----- Original Message -----
> > > > > > > From: "Jeff Urlwin" <[EMAIL PROTECTED]>
> > > > > > > To: "Liu Haifeng" <[EMAIL PROTECTED]>; "Jeff Urlwin"
> > > > > > > <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> > > > > > > Sent: Thursday, August 29, 2002 10:17 AM
> > > > > > > Subject: RE: Failure of ODBC connection with Access
> > > > > > >
> > > > > > >
> > > > > > > > I have a few questions:
> > > > > > > >
> > > > > > > > What's the error message?
> > > > > > > > What version of the Access ODBC driver are you using?
> > > > > > > > Do you have access to the path/file?
> > > > > > > >
> > > > > > > > Regards,
> > > > > > > >
> > > > > > > > Jeff
> > > > > > > > >
> > > > > > > > > Thanks to Jeff first, but I still failed in both
> ways either
> > > > > > > by DSN-less
> > > > > > > > > connection or by system DSN connnection.
> > > > > > > > > ....
> > > > > > > > > #my $dbn="driver=Microsoft Access Driver
> > > > > > > (*.mdb);dbq=\\\\genethon\\data
> > > > > > > > > drive\\www\\DB\\newgene.mdb";
> > > > > > > > > my $dbn="newgene";
> > > > > > > > > my $dbh=DBI->connect('dbi:ODBC:$dbn','','')|| die
> > > > > "$DBI::errstr\n";
> > > > > > > > > ...
> > > > > > > > > where "newgene" is a system DSN I have added.
> > > > > > > > >
> > > > > > > > > I do use DBD::ODBC 0.28.   Any more suggestions?
> > > > > > > > >
> > > > > > > > > Regards
> > > > > > > > > Haifeng
> > > > > > > > >
> > > > > > > > > ----- Original Message -----
> > > > > > > > > From: "Jeff Urlwin" <[EMAIL PROTECTED]>
> > > > > > > > > To: "Liu Haifeng" <[EMAIL PROTECTED]>;
> <[EMAIL PROTECTED]>
> > > > > > > > > Sent: Wednesday, August 28, 2002 8:32 PM
> > > > > > > > > Subject: RE: Failure of ODBC connection with Access
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > Hi,
> > > > > > > > > > >
> > > > > > > > > > > I am wondering how to successfully connect to
> Microsoft
> > > Access
> > > > > > > > > > > database using DBD::ODBC.  Here is the snippet of my
> code:
> > > > > > > > > >
> > > > > > > > > > Use perldoc DBD::ODBC and you will see an example of a
> > > DSN-less
> > > > > > > > > connection,
> > > > > > > > > > which is what you are trying to do.  Otherwise,
> > > setup a system
> > > > > > > > > DSN and use
> > > > > > > > > > DBI->connect("dbi:ODBC:$DSN", etc)
> > > > > > > > > > >
> > > > > > > > > > > .....
> > > > > > > > > > > my $dbdrive=DBI->install_driver('ODBC');
> > > > > > > > > > > my $dbn="driver=Microsoft Access Driver
> > > > > > > > > > > (*.mdb);dbq=\\\genethon\\data
> > > drive\\www\\DB\\newgene.mdb";
> > > > > > > > > > > my $dbh=$dbdrive->connect('dbi:ODBC:$dbn','','')|| die
> > > > > > > > > "$DBI::errstr\n";
> > > > > > > > > > > ....
> > > > > > > > > >
> > > > > > > > > > Thre are two problems here:
> > > > > > > > > > 1) you should never need to call
> install_driver.  Just use
> > > > > > > > > DBI->connect()
> > > > > > > > > > 2) Your dbq= has a missing backslash in front of the
> server
> > > name
> > > > > (3
> > > > > > > > > instead
> > > > > > > > > > of 4)
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > > where "genethon" is my PC name and the database file
> > > > > > > > > > > "newgene.mdb" actually locates under C:\data
> drive\www\DB.
> > > > > > > > > > >
> > > > > > > > > > > The error message is "[Microsoft][ODBC Driver
> > > Manager] Data
> > > > > > > > > > > source name not found and no default driver specified
> > > > > > > > > > > <SQL-IM002><DBD:db-login/SQLConnect err=-1>"
> > > > > > > > > > >
> > > > > > > > > > Also, check which version of DBD::ODBC you are using.
> > > > > > > There were some
> > > > > > > > > > spurious error messages in the .28 when using a
> long name
> > > > > > > > > connecting like
> > > > > > > > > > this.  I think you'll be ok, but...
> > > > > > > > > >
> > > > > > > > > > Regards,
> > > > > > > > > >
> > > > > > > > > > Jeff
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>


Reply via email to