tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nikola Milutinovic" <Nikola.Milutino...@ev.co.yu>
Subject Problems with PostgreSQL + Tomcat solved - sort of
Date Thu, 25 Oct 2001 11:52:20 GMT
Hi all.

Now it's working all of a sudden. I have made three changes:

- removed $CATALINA_OPTS=-Djdbc.drivers=org.postgresql.Driver
- removed: import="javax.sql.*" from page directive
- added: Class.forName( "org.postgresql.Driver" ) to my code

Could someone answer these questions:

QUESTION 1. What is the proper way of specifying a JDBC driver in Tomcat?

In a standalone application I will use "-Djdbc.drivers=..." and it works. Tomcat, obviously,
doesn't like it. Is there some property file, where I can specify JDBC drivers? I would like
to make my code as independant of a database used, as possible. By specifying which JDBC driver
I'm using and supplying JDBC connection parameters in web.xml I am getting there.

QUESTION 2. Should I put as a parameter in my web.xml?

QUESTION 3. How would Tomcat use JDBC realm on, say, PostgreSQL, anyway?

QUESTION 4. Could it be that importing "javax.sql.*" broke my JSP?

I was getting all sort of *compiler* errors, not runtimes. Jasper was trying to parse "postgresql"
(inside JDBC connection string???) to Integer:

java.lang.NumberFormatException: postgresql
        at java.lang.Integer.parseInt(Integer.java, Compiled Code)
        at java.lang.Integer.parseInt(Integer.java, Compiled Code)
        at org.apache.jasper.compiler.Compiler.getJspLineErrors(Unknown Source)
...

on Class.forName( "org.postgresql.Driver" ) it complained:

/usr/local/java/tomcat-4.0/work/mercury.ev.co.yu/addr_book/firm$jsp.java:20: Type expected.
        Class.forName( "org.postgresql.Driver" );

It was getting very weird. Thank God, it is working now, but being an administrator, I'd like
to know this in the future.

Nix.
Mime
View raw message