Attachment 1773
i have problem in this exception i code exception error
with type -4
Printable View
Attachment 1773
i have problem in this exception i code exception error
with type -4
import java.sql.*;
public class SelectTest
{
public static void main(String [] args) throws Exception
{
try
{
//register driver and establish the connection
Class.forName("oracle .jdbc.driver.OracleDriver");
Connection con =DriverManager.getConnection("jdbc:oracle:thin:@lo calhost:1521:ORCL.REGRESS.RDMS.DEV.US.ORACLE.COM", "scott","tiger");
//create statement object
Statement st =con.createStatement();
//send and execute query
ResultSet rs =st.executeQuery("select * from student;");
// precess the result object
while(rs.next())
{
System.out.println(rs.getInt("sno")+" "+rs.getString("sname")+" " +rs.getString("marks"));
}
//close jdbc objects
rs.close();
st.close();
con.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}//main()
}//class
error message above code please find to us
For future reference, please copy and paste all error message directly to the forums, as well as wrap your code in the code tags.
Based upon the image, you've got a ClassNotFoundException, in which case you need to add the appropriate Driver of your database to the classpath