我想使用类型 4 驱动程序。我正在使用 eclipse,oracle 10g 。我下载了 ojdbc14.jar 并将其放在 javaBuildPath 中。
这是我的代码。它向我显示错误
import java.sql.*;
import java.util.Properties;
public class Demo
{
public static void main(String args[]) throws SQLException, ClassNotFoundException
{
Class.forName("oracle.jdbc.pool.OracleDataSource");
String url = "jdbc:oracle:thin:@localhost:8080:";
Connection conn = DriverManager.getConnection(url,"system","1234");
String sql ="select sysdate as current_day from dual";
PreparedStatement preStatement = conn.prepareStatement(sql);
ResultSet result = preStatement.executeQuery();
while(result.next())
{
System.out.println("Date" + result.getString("current_day"));
}
}
}