Home > database >  Java eclipse to connect the oracle database errors, parsing
Java eclipse to connect the oracle database errors, parsing

Time:10-05

Source: the import of Java. SQL. Connection;
Import the Java. SQL. DriverManager;
Import the Java. SQL. SQLException;

Public class OrclaeConnectionDemo {
Public static final String DBDRIVER="... The oracle JDBC driver OrcaleDriver ";
Public static final String DBURL="JDBC: oracle: thin: @ localhost: 1521: wouldn";
Public static final String DBUSER="Scott";
Public static final String DBPWD="tiger";

Private static Connection conn=null;

Public static void main (String [] args) {
Try {
Class.forname (DBDRIVER);
Conn=DriverManager. GetConnection (DBURL, DBUSER, DBPWD);
If (conn!=null) {
System. Out.println (" connection success!" );
} else {
System. Out.println (" connection failed!" );
}
} the catch (a ClassNotFoundException e) {
//TODO Auto - generated the catch block,
e.printStackTrace();
} the catch (SQLException e) {
//TODO Auto - generated the catch block,
e.printStackTrace();
} the finally {
Try {
conn.close();
} the catch (SQLException e) {
//TODO Auto - generated the catch block,
e.printStackTrace();
}
}

}

}




Error: Java. Lang. ClassNotFoundException: oracle. JDBC driver. OrcaleDriver
The at java.net.URLClassLoader.findClass URLClassLoader. Java: (381)
The at Java. Lang. This. LoadClass (424). This Java:
At sun. Misc. The Launcher $AppClassLoader. LoadClass (331). The Launcher Java:
The at Java. Lang. This. LoadClass (357). This Java:
The at Java. Lang. Class. ForName0 (Native Method)
The at Java. Lang. Class.forname (264) Class. Java:
The at OrclaeConnectionDemo. Main (OrclaeConnectionDemo. Java: 15)
The Exception in the thread "main" Java. Lang. NullPointerException
The at OrclaeConnectionDemo. Main (30) OrclaeConnectionDemo. Java:

CodePudding user response:

The import drivers? Driver version conform to?

CodePudding user response:

Don't drive,,,

CodePudding user response:

reference 1st floor sych888 response:
import drive? Driver version conform to?

Which drivers to use oracle 11 g?

CodePudding user response:

Online to find 11 g now

CodePudding user response:

Ojdbc6. Jar