Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.sql.SQLException: Column not found

843785Aug 11 2008 — edited Aug 12 2008
hi ,
i encountered a problem while executing the following code.


Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:bandctech","sample","sample");
Statement st=con.createStatement();
ResultSet rst1=st.executeQuery("select max(sno) from staffdetail");
rst1.next();
so=rst1.getInt("sno");

while excution it shows:
java.sql.SQLException: Column not found

i have "sno" field in my table.
i even used:

ResultSet rst1=st.executeQuery("select sno from staffdetail");
rst1.next();
so=rst1.getInt("sno");

please suggest where i did wrong in the coding.

thank you
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 9 2008
Added on Aug 11 2008
14 comments
4,976 views