JDBC throwing java.lang.NullPointerException -



JDBC throwing java.lang.NullPointerException -

i not sure why error occuring column has data's in , able execute statement using toad

seek { system.out.println("executing sql"); string r = "select id pa_str_rtl"; system.out.println("starting executing sql"); st = con.createstatement(); resultset rs = st.executequery(r); while(rs.next()) { int r1 = rs.getint("id"); system.out.println(r1); } } catch(sqlexception e) { e.printstacktrace(); }

as suspected, connection null. means problem isn't in of code posted. before when connection.

typically means have try/catch around creating connection , ignoring error. mutual errors not having database driver jar in classpath (class not found) or not having valid connection string.

jdbc

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -