I just finished the system today. wrote an Oracle data Connectivity test but reported a bad version number in class file error, the online discovery is a JDK setup problem. MyEclipse defaults to jdk5.0 and the environment I run is set jdk6.0 ....
Workaround Configure the MyEclipse jer steps: Window-> preferences->java-> installed jre-> Select-> Edit->jre home directory-> browse-> find jdk1.6 Installation path automatically load- >ok
Run it again, fix it.
The code is as follows:
Import java.sql.*;
Public class Orcldemo {
public static void Main (string[] args) {
try {
Load driver
class.forname ("Oracle.jdbc.driver.OracleDriver");
// Create connection Note URL path "jdbc:oracle:thin:@+" host: "+post+": "+sid
//host represents the IP or domain name of the server on which the database resides;
//post indicates the server port number Oracle defaults to 1521
//sid to the database identity (database name)
in the server Connection conn = drivermanager.getconnection (
"Jdbc:oracle:thin: @localhost: 1521 : Jzbr ", Scott", "Tiger");
string sql = "SELECT * from emp";
& nbsp Statement stmt = Conn.createstatement ();
resultset rs = stmt.executequery (SQL);
while (Rs.next ()) {
system.out.println (Rs.getint (1));
system.out.println (rs.getstring (2));
}
Rs.close ();
Stmt.close ();
Conn.close ();
catch (ClassNotFoundException e) {
E.printstacktrace ();
catch (SQLException e) {
E.printstacktrace ();
}
}
}