resultset problem

HiI tried to execute following code,i got problem:Statement stmt;ResultSet rs = stmt.executeQuery("select *......"); how can i check whether any record return or not any record return.thanks
[239 byte] By [rokar] at [2007-9-26 4:09:26]
# 1

Hi rokar,

The ResultSet is not pointing to a row when it is created. You have to do a rs.next() to get the first row. The rs.next() will return false if there are no more rows to get. So if nothing is returned, the first rs.next() will return false.

Hope this will help you.

Anil.

Developer Technical Support

Sun Microsystems, India

http://www.sun.com/developers/support

ramanil_indts at 2007-6-29 13:12:29 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2
hi anil,can u please tell me how we can get the no of rows in result set..i am using thin driver and it is connecting properly and working fine with fwd only type record set but if i try to give sensitive it is giving error .can u pls tell me
akulakiran at 2007-6-29 13:12:29 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3

>"how can i check whether any record return or not any record return."

Statement stmt;

Srtring query = "select *......";

System.out.println(query);

ResultSet rs = stmt.executeQuery(query);

after running this portion of the program, you can cut and paste the query from the system console to a SQL*Plus editor to execute the SQL statement. This way you can see if it is the actual SQL statement causing you problems or some other programming/logic error.

>"i am using thin driver and it is connecting properly

>and working fine with fwd only type record set but if i

>try to give sensitive it is giving error ."

what is the error message? are you using classes111.zip or classes12.zip? if you post the relevant code it would be easier to help you.

Jamie

jlrober at 2007-6-29 13:12:29 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 4

hi

can u please tell me how i can get no of rows from a result set..

i am using thin drivers and connecting to remote database,every thing is working fine if i use fwd only type ,but if i use sensitive type it is giving error

code:

stmt=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);

i am getting error at this line

error :

java.lang.AbstractMethodError:oracle/jdbc/driver/oracleconnection.createStatement

please help me

akulakiran at 2007-6-29 13:12:29 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 5
does your jdk include jdbc 2.0? Is your driver updated to support jdbc 2.0 features? have you recently updated either? I am running jdk 1.3 and oracle thin(classes12.zip) have not had problems creating/using scrollable resultsets?Jamie
jlrober at 2007-6-29 13:12:29 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 6
use the next()example if resultSet()doSome()elseSystem.out.println("End records");
gmullerb at 2007-6-29 13:12:29 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...