Re: JDBC getConnection with Tomcat

From: "Michael Swierczek" <mike(dot)swierczek(at)gmail(dot)com>
To: "Murray Warren" <murray_warren(at)bah(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: JDBC getConnection with Tomcat
Date: 2006-06-30 19:33:51
Message-ID: 68b5b5880606301233o1269f1c4ga2196aedbd0c5d3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

> On 6/30/06, Murray Warren <murray_warren(at)bah(dot)com> wrote:
> I'm sorry for the posting, but recently re-installed my development machine
> to Win XP from Win 2000. I had everything working fine with Win 2000. My
> issue is when I go the query the database from my jsp page I receive this
> HTTP Status 500 error:

If we can't help you, it may be better to post to Tomcat mailing
lists. (But for all I know, they sent you here.)

1. Can you connect to the database with psql.exe on the command
prompt, pgAdmin, or any other tool?
2. Did you remember to put the appropriate JDBC driver class
(postgresql.jar works, I've heard others work) in the Tomcat
classpath?
3. Does your xml configuration file have the right settings for the
connection? Mine has
<Realm
className="org.apache.catalina.realm.JDBCRealm"
connectionName="<username>"
connectionPassword="<password>"
connectionURL="jdbc:postgresql://192.168.2.61:5432/<mydatabase>"
driverName="org.postgresql.Driver"
roleNameCol="categoryname"
userCredCol="password"
userNameCol="username"
userRoleTable="logincategory_view"
userTable="login_view"
debug="99"/>

Of course, all values inside <> (except for the opening and closing
greater than and less than) have the appropriate values filled in.

Good luck!
-Mike Swierczek

>
> Exception
> javax.servlet.ServletException
>
> org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:523)
> . . .
>
>
> root cause
> java.lang.NullPointerException
> fssm.dao.UnitDAO.getUnit(UnitDAO.java:104)
>
> fssm.manager.UnitManager.HqsUnit(UnitManager.java:22)
>
> Here is what's on line 104 of UnitDAO.java:
>
> . . .
> Connection conn = null;
> Statement stmt = null;
> ResultSet rs = null;
>
> try
> {
> conn = getConnection();
> stmt = conn.createStatement();
>
> rs = stmt.executeQuery(GET_HQ_UNITS_SQL);
> . . .
>
> Any suggestion for what I should check. I'm thinking I have a path problem.
> My web.xml points to an application.xml file in
> CATALINA_HOME\conf\Catalina\localhost directory.
>
> Thank you,
> Warren

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Andrej Ricnik-Bay 2006-06-30 20:37:08 Re: insert more than one rows
Previous Message Murray Warren 2006-06-30 19:14:18 JDBC getConnection with Tomcat