Re: DBI::ODBC in a web application

Re: DBI::ODBC in a web application

am 23.03.2006 21:22:49 von victorchurchill

On 23/03/06, Garrett, Philip (MAN-Corporate) w=
rote:
> > -----Original Message-----
> > From: Robert Hicks [mailto:sigzero@earthlink.net]
> > Sent: Thursday, March 23, 2006 7:13 AM
> > To: dbi-users@perl.org
> > Subject: DBD::ODBC in a web application
> >
> > If I create a test script to connect to a Microsoft Access database
> > that is on a network (UNC) drive I can connect to it fine.
> >
> > If I try to do the same thing from a web application running under
> > Apache I get the following error:
> >
> > Error executing run mode 'display_task_page': Can't connect to data
> > source driver=3DMicrosoft Access Driver (*.mdb);dbq=3D\\Resolver\Users\=
BH-
> > icks\Public\Project_task_report_2003.mde, no database driver specified
> > and DBI_DSN env var not set at
> > C:/Perl/site/lib/CGI/Application/Plugin/DBH.pm line 42 at
> > D:/Projects/www/DEV/exp/index.cgi line 14
> >
> > I have tried mapping that UNC path to a local drive letter as well
> > with the same error.
> >
> > I am not sure if the problem resides with Apache, the modules I am
> > using for the web application of DBD::ODBC itself.
> >
> > Any pointers?
>
> It looks like the "dbi:ODBC:your_datasource_name" parameter isn't making
> it into the DBI->connect call (although some part of it is).
>
> If you enable DBI->trace(1), the call to DBI->connect will go into your
> Apache error_log, so you can see exactly what is getting passed to the
> connect method.
>
> Philip
>

I had similar trouble getting DBI running under the control of the
Apache userid and got round it by setting the environment for the web
server in httpd.conf:

SetEnv LD_LIBRARY_PATH /usr/local/OraClient/instantclient_10_2/lib
SetEnv ORACLE_HOME /usr/local/OraClient/instantclient_10_2

You will obvoiusly need different values but something like this might
work fo ryou.

hth
--
cheers,
victor

Victor Churchill, Bournemouth, U.K.

Re: DBI::ODBC in a web application

am 24.03.2006 16:26:53 von tomAtLinux

--------------enig117E76264050DAB39FE452A3
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Well I think that you problem is a environment problem as already
outlined. If you need to have access to ENV-Variables you must forward
them explicitly to the cgi because they are not passed by default
because of security risks.

For more information see:
http://httpd.apache.org/docs/2.0/mod/mod_env.html

Tom


Victor Churchill wrote:
> On 23/03/06, Garrett, Philip (MAN-Corporate) wrote:
>
>>>-----Original Message-----
>>>From: Robert Hicks [mailto:sigzero@earthlink.net]
>>>Sent: Thursday, March 23, 2006 7:13 AM
>>>To: dbi-users@perl.org
>>>Subject: DBD::ODBC in a web application
>>>
>>>If I create a test script to connect to a Microsoft Access database
>>>that is on a network (UNC) drive I can connect to it fine.
>>>
>>>If I try to do the same thing from a web application running under
>>>Apache I get the following error:
>>>
>>>Error executing run mode 'display_task_page': Can't connect to data
>>>source driver=Microsoft Access Driver (*.mdb);dbq=\\Resolver\Users\BH-
>>>icks\Public\Project_task_report_2003.mde, no database driver specified
>>>and DBI_DSN env var not set at
>>>C:/Perl/site/lib/CGI/Application/Plugin/DBH.pm line 42 at
>>>D:/Projects/www/DEV/exp/index.cgi line 14
>>>
>>>I have tried mapping that UNC path to a local drive letter as well
>>>with the same error.
>>>
>>>I am not sure if the problem resides with Apache, the modules I am
>>>using for the web application of DBD::ODBC itself.
>>>
>>>Any pointers?
>>
>>It looks like the "dbi:ODBC:your_datasource_name" parameter isn't making
>>it into the DBI->connect call (although some part of it is).
>>
>>If you enable DBI->trace(1), the call to DBI->connect will go into your
>>Apache error_log, so you can see exactly what is getting passed to the
>>connect method.
>>
>>Philip
>>
>
>
> I had similar trouble getting DBI running under the control of the
> Apache userid and got round it by setting the environment for the web
> server in httpd.conf:
>
> SetEnv LD_LIBRARY_PATH /usr/local/OraClient/instantclient_10_2/lib
> SetEnv ORACLE_HOME /usr/local/OraClient/instantclient_10_2
>
> You will obvoiusly need different values but something like this might
> work fo ryou.
>
> hth
> --
> cheers,
> victor
>
> Victor Churchill, Bournemouth, U.K.
>
>


--------------enig117E76264050DAB39FE452A3
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org

iD8DBQFEJA/CkVPeOFLgZFIRAodJAKCrd+kYOj/3EYDAZslXTwvPo7o7ZQCf UrkG
2HBgx3kGIfx9ZnI5cowSLR4=
=OORs
-----END PGP SIGNATURE-----

--------------enig117E76264050DAB39FE452A3--