Exception in thread "main"

From: Mathew McBride <mcbridematt(at)iprimus(dot)com(dot)au>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Exception in thread "main"
Date: 2002-10-08 20:24:48
Message-ID: 200210090624.48365.mcbridematt@iprimus.com.au
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?

Browse pgsql-jdbc by date

  From Date Subject
Next Message Mathew McBride 2002-10-08 20:55:38 Fwd: Exception in thread "main"
Previous Message rfr 2002-10-08 18:52:25 Re: ERROR compiling JDBC 7.3 b2 with JDK1.4.1