Using standard JDBC code for JAVA-ORACLE connection however not working.
This may be asked earlier but i am not able to debug it myself so asking here. Request for help.
Code:
import java.sql.*;
class OracleCon {
  public static void main(String args[]) {
    try {
        // step1 load the driver class
        Class.forName("oracle.jdbc.driver.OracleDriver");
        // step2 create the connection object
        Connection con = DriverManager.getConnection(
                "jdbc:oracle:thin:@localhost:1521:xe", "system",
                "nikhil.nik");
        /*
         * Hostname: Host system for the Oracle database. For your Express
         * Edition database, the hostname is localhost. Port: Listener port.
         * The default is 1521. SID: Database name. The default for Express
         * Edition is xe.
         */
        // step3 create the statement object
        Statement stmt = con.createStatement();
        // step4 execute query
        ResultSet rs = stmt.executeQuery("SELECT TEST_NAME FROM TEST1");
        // System.out.println(rs);
        while (rs.next())
            System.out.println(rs.getInt(1) + "  " + rs.getString(2) + "  "
                    + rs.getString(3));
        // step5 close the connection object
        con.close();
    } catch (Exception e) {
        System.out.println(e);
    }
}
}
Stacktrace:
java.sql.SQLException: Fail to convert to internal representation 
  at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) 
  at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146) 
  at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208) 
  at oracle.jdbc.driver.CharCommonAccessor.getInt(CharCommonAccessor.java:132) 
  at oracle.jdbc.driver.OracleResultSetImpl.getInt(OracleResultSetImpl.java:521) 
  at dbPrograms.OracleCon.main(OracleCon.java:31) 
    
e.printStackTrace();. Your way loses all the important information in the exception.TEST_NAMEis not aint