当前位置: 技术问答>java相关
这在J2sdk1_3_1里怎么有错误??
来源: 互联网 发布时间:2015-10-25
本文导语: TestLink.java ============================== import java.sql.*; public class TestLink { public static void main(String[] args) { try { DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver...
TestLink.java
==============================
import java.sql.*;
public class TestLink {
public static void main(String[] args)
{
try {
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Class.forName("oracle.jdbc.driver.OracleDriver");
String strConn = "jdbc:oracle:oci8:@zheng";
String User = "system";
String Password = "manager";
Connection Conn = DriverManager.getConnection (strConn, User, Password);
System.out.println("Sucess Connect!");
} catch (ClassNotFoundException e) {
System.out.println("Not Class!");
}
catch (SQLException e) {
System.out.println("SQL Exception!");
}
}
}
在J2sdk1.4里明明是OK的,在J2sdk1.3里说找不到main,怎么回事??
另外这个测试说明我在CLASSPATH里设置的Oracle路径没问题,但
JSP(Tomcat做服务器)怎么找不到oracle.jdbc.driver.OracleDriver类??
==============================
import java.sql.*;
public class TestLink {
public static void main(String[] args)
{
try {
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Class.forName("oracle.jdbc.driver.OracleDriver");
String strConn = "jdbc:oracle:oci8:@zheng";
String User = "system";
String Password = "manager";
Connection Conn = DriverManager.getConnection (strConn, User, Password);
System.out.println("Sucess Connect!");
} catch (ClassNotFoundException e) {
System.out.println("Not Class!");
}
catch (SQLException e) {
System.out.println("SQL Exception!");
}
}
}
在J2sdk1.4里明明是OK的,在J2sdk1.3里说找不到main,怎么回事??
另外这个测试说明我在CLASSPATH里设置的Oracle路径没问题,但
JSP(Tomcat做服务器)怎么找不到oracle.jdbc.driver.OracleDriver类??
|
tomcat中直接把oraclejdbc.jar放到common/lib下就行。