I have a problem with fetching a timestamp from an Oracle database.
The table is created as follows:
create table csi(start_time timestamp);
Then I selected the value as follows:
import java.sql.*;
public class hel
{
public static void main(String args[])
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:mohit","system","rock");
PreparedStatement ps=con.prepareStatement("select * from csi");
ResultSet rs=ps.executeQuery();
while(rs.next())
{
//System.out.println(rs.getString(4));
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
But it throws the following exception:
java.sql.SQLException: General error
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLPrepare(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcConnection.prepareStatement(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcConnection.prepareStatement(Unknown Source)
at hel.main(hel.java:10)
How is this caused and how can I solve it?