Re: JDBC problems
Posted in 1999
Damjan Try finding out exactly what error is happening, like so: try { // connection code here } catch (SQLException sqle) { System.out.println("Cant connect: " + sqle.getMessage()); sqle.printStackTrace(); } try { for (...) { // do your select here } } catch (SQLException sqle) { System.out.println("Cant SELECT: " + sqle.getMessage()+ "(" + sqle.getErrorCode() + ")"); sqle.printStackTrace(); } This will tell you exactly what error (SQLCODE + SQLERRM) you are getting plus a stacktrace which should lead you to a solution to your problem. BTW, did you ever try running the Java program on an SE database? I posted a question about this few days ago but haven't gotten any reply. HTH Sujit Damijan Sencar <dsencar@animus.mf.uni-lj.si> on 06/18/99 04:24:20 AM Please respond to Damijan Sencar <dsencar@animus.mf.uni-lj.si> To: informix-list@iiug.org cc: (bcc: Sujit Pal) Subject: JDBC problems Hi! I wrote a short program in java. It is just simple query program where it step through a table with ~400000 records. The problem is that after a random number (in range from 20000 - 300000) of quries program quits. I tried this program on IDS7.3 on Linux, SCO in different combination of JDK and JDBC drivers but always with the same result. Here is a part of a program ... connection stuff here deleted for (int iii =1;iii<400000;iii++) { sql_str = "SELECT * FROM krvodajalec WHERE id="+iii; ResultSet rs = sq_stmt.executeQuery(sql_str); while (rs.next()) { int id = rs.getInt("id"); System.out.println("ID je : " + id); } } //for } catch (SQLException e) { System.out.println("ERROR: failed to connect!"); } ....some more stuff some ideas what could be wrong? Thanx, damijan