error if retrieved values are null
Hello, i am trying to retrieve the value of a column which can be null but i get a very general message:java.sql.SQLException.
this is the code i use:
try
{
Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection( "jdbc:odbc:hospital","doctor", "doctor");
PreparedStatement pstmt = con.prepareStatement("SELECT aktinografia.ektimhsh FROM aktinografia WHERE aktinografia.aktin_code = ? ");
pstmt.setInt(1,g2);
ResultSet rset=pstmt.executeQuery();
while(rset.next())
{
str1= rset.getString("ektimhsh");
}
pstmt.close();
con.close();
}
catch(SQLException e)
{
out.print(e);
}
Please help!
Thanks in advance.

