Fwd: Exception in thread "main"

From: Mathew McBride <matt(at)mcbridematt(dot)dhs(dot)org>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Fwd: Exception in thread "main"
Date: 2002-10-08 20:55:38
Message-ID: 200210090655.38029.matt@mcbridematt.dhs.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc


Hi,

I wrote up some code to retrive a company name associated with a id from a
database. This is the code I used:

try {
Connection db = DriverManager.getConnection("jbdc:postgresql:vapilot",
"postgres" , " ");
PreparedStatement st = db.prepareStatement("SELECT \"va_vairline\" FROM
\"va_pilots\" WHERE va_id='1'");
ResultSet rs = st.executeQuery();
add(name);
add(va);
va.setText(rs.getString("va_vairline"));
}
catch (SQLException se) {
System.out.println("ERROR: Cannot Execute SQL query");
}

I compiled and ran it:
java -Djdbc.drivers=org.postgresql.Driver org/vaproject/vapilot/va_pilot
And it said this:
Exception in thread "main" java.lang.NullPointerException
at org.postgresql.jdbc2.ResultSet.getString(ResultSet.java:168)
at org.postgresql.jdbc2.ResultSet.getString(ResultSet.java:553)
at org.vaproject.vapilot.infoPanel.<init>(va_pilot_gui.java:130)
at org.vaproject.vapilot.va_pilot_gui.<init>(va_pilot_gui.java:37)
at org.vaproject.vapilot.va_pilot.<init>(va_pilot.java:14)
at org.vaproject.vapilot.va_pilot.main(va_pilot.java:27)

I used the file jdbc7.2dev-1.2.jar from the RedHat 7.3 RPM postgresql-jdbc.
Should I either download a new one from the JDBC driver website or compile
one myself?

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Julian Brown 2002-10-08 23:16:40 I am totally lost
Previous Message Mathew McBride 2002-10-08 20:24:48 Exception in thread "main"