Results 1 to 5 of 5
- 08-07-2009, 10:48 PM #1
Member
- Join Date
- Mar 2009
- Posts
- 6
- Rep Power
- 0
ResultSet next() returns false Yet Tuples Present
Please help me figure out what could be going on.I am using Oracle thin driver and PreparedStatement.
ThanksJava Code:public boolean aunthenticate1(Connection conn,String username,String password) throws SQLException{ PreparedStatement st2 = null; try{ String uquery = "Select username,password from mjzeko.users where username= ? AND password= ? "; st2=conn.prepareStatement(uquery); st2.setString(1, username); st2.setString(2, password); st2.executeQuery(); ResultSet res =st2.getResultSet(); System.out.println("2222"); //boolean t=res.next(); System.out.print(res.getRow()); int count=0; while (res.next()){ System.out.print("res.getString(1)"); count++; System.out.print(count); } if(count > 0) return true; else { System.out.print(count); return false; } } catch(Exception ex) { ex.printStackTrace(); System.out.print("This is where I end up"); ex.getMessage(); ex.getCause(); return false; } finally{ st2.close(); } }Last edited by Fubarable; 08-08-2009 at 12:36 PM. Reason: code tags added to aid in readability
- 08-08-2009, 06:43 AM #2
Senior Member
- Join Date
- Dec 2008
- Location
- Hong Kong
- Posts
- 473
- Rep Power
- 5
would you mind giving the incorrect output of the program
- 08-08-2009, 07:50 AM #3
Member
- Join Date
- Mar 2009
- Posts
- 6
- Rep Power
- 0
ResultSet next() Returns false Yet Tuples Present -CODE OUTPUT
mtyoung thanks for the reply.The code outputs
2222
00 //first 0=getRow() 0=count
falsefalse //one from return and the last one from authenticate1()
Thanks
- 08-11-2009, 10:52 AM #4
Senior Member
- Join Date
- Dec 2008
- Location
- Hong Kong
- Posts
- 473
- Rep Power
- 5
is your database table contains record with username= ? "AND" password= ?
- 08-11-2009, 11:31 AM #5
Similar Threads
-
Reading a zip/text file present in a MAC Bundle
By Prasannaa in forum Advanced JavaReplies: 1Last Post: 08-07-2008, 03:05 PM -
How to read a .EML file present on Remote Desktop?
By anil@prokarma in forum New To JavaReplies: 0Last Post: 06-12-2008, 02:05 PM -
hibernate lazy=False
By Ed in forum JDBCReplies: 2Last Post: 07-02-2007, 07:54 PM -
To send email of page present Web from a Jsp
By Marcus in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 06-09-2007, 04:08 AM -
How can i set the table's column dragable/movable false and cell editable
By johnt in forum AWT / SwingReplies: 4Last Post: 05-19-2007, 11:15 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks