hi, this is driving me crazy; i'm trying to retrieve records from a local oracle database (on my laptop) - the oracle driver gets registered, it connects to the database BUT when i try to executeQuery() with a valid SQL it throws the following exception; Exception occurred during event dispatching: java.lang.NullPointerException at Retrieve.retrieve(Retrieve.java:103)........... i have also tried using an Access db but it throws the same exception. what am i missing ??? NOTE : using jdk 1.3 and oracle 7.3.4 any help will be appreciated. thanx go java !!
Hello friend! The problem may be with undefined resultset.After the connection follow the given below lines: Statement st = cn.createStatement() ResultSet rs1 = st.executeQuery("select * from *table name*"); while(rs.next()) {System.out.println(rs.getInt("field name")); } I hope this will solve the problem. regards, Atonu Bhowmik [This message has been edited by Paul Wheaton (edited November 13, 2000).]
The following code works for me. JDK 1.3 / JDBC ver 1.0 / NT / Oracle 7.3.4 on a unix box. Hope this helps... <code> import java.sql.*; public class CreateCoffees { public static void main(String args[]) {
catch(java.lang.ClassNotFoundException e) { System.err.print("ClassNotFoundException: "); System.err.println(e.getMessage()); } try { con = DriverManager.getConnection(url "USERID", "PASSWORD"); stmt = con.createStatement(); stmt.executeUpdate(createString); stmt.close(); con.close(); } catch(SQLException ex) { System.err.println("SQLException: " + ex.getMessage()); } } // end of main } // end of class </code>
[This message has been edited by Monty Ireland (edited November 08, 2000).] [This message has been edited by Monty Ireland (edited November 08, 2000).] [This message has been edited by Monty Ireland (edited November 09, 2000).]