Please browse the categories below to previous answers to questions like yours. If you do not find the answer for your particular situation, ask for help on the appropriate mailing list.
(Answer) (Category) Java Apache Project : (Category) Apache JServ 1.0 : (Category) Programming and Misc. Tidbits :
-Djdbc.driver=... with servlets
----------
From: "Craig R. McClanahan" cmcclanahan@mytownnet.com
To: Java Apache Users java-apache-users@list.working-dogs.com
Subject: Re: -Djdbc.driver=... with servlets
Date: Sun, Jul 25, 1999, 9:51 PM

Jim Richards wrote:

>
> I can get my Java Servlet to run if I use a
>
>         Class.forName("prostgresql.Driver");
>
> line before I do the
>
>         DriverManager.getConnection(urs, user, passwd);
>
> But I'd prefer not to have to do that so the
> Servlet is jdbc driver independant. I know if I run
> a Java programme from the command line I can use
>
>         -Djdbc.driver=postgresql.Driver
>
> on the command line, and I can set it various .properties
> files, but I can't work out the settings in the
> jserv.properities file for the equivalent.
>

In the jserv.properties file, add a line like this:

    wrapper.bin.parameters=-Djdbc.driver=postgresql.Driver

You will also find that most connection pool implementations let you 
specify the name
of the JDBC driver class as an initialization parameter, so you can maintain source
code independence from a particular driver.

Craig McClanahan
[Append to This Answer]
Previous: (Answer) How do I redirect the ServletOutputStream?
Next: (Answer) How do I execute a CGI script from a servlet?
This document is: http://java.apache.org/faq/?file=261
[Search] [Appearance] [Show Expert Edit Commands]
This is a Faq-O-Matic 2.709.
Please browse the categories below to previous answers to questions like yours. If you do not find the answer for your particular situation, ask for help on the appropriate mailing list.