JDBC链接Oracle出错 跪求高手指点
源码:privatefinalStringDB_DRIVER="oracle.jdbc.driver.OracleDriver";privatefinalStringDB...
源码:
private final String DB_DRIVER = "oracle.jdbc.driver.OracleDriver";
private final String DB_URL ="jdbc:oracle:thin:@127.0.0.1:1521:orcl";
private final String DB_USER="test";
private final String DB_PAS="111111";
private Connection conn;
private Statement stat;
public DBUtils() throws SQLException, ClassNotFoundException
{
Class.forName(DB_DRIVER);
this.conn = DriverManager.getConnection(DB_URL,DB_USER,DB_PAS);
this.stat = this.conn.createStatement();
}
用官网提供的OJDBC6链接数据库出错,换用ojdbc14.jar不改代码就可以正常访问,但会影响其他程序的使用,jdk是1.6.43,以下是ojdbc6运行时报的错误:
Exception in thread "main" java.sql.SQLException: Undefined Error
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:412)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:531)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at cn.sjl.oracle.conn.DBUtils.<init>(DBUtils.java:29)
at cn.sjl.database.test.TestConnectOracle.main(TestConnectOracle.java:12)
Caused by: oracle.net.ns.NetException: Undefined Error
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:385)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1042)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:301)
... 8 more 展开
private final String DB_DRIVER = "oracle.jdbc.driver.OracleDriver";
private final String DB_URL ="jdbc:oracle:thin:@127.0.0.1:1521:orcl";
private final String DB_USER="test";
private final String DB_PAS="111111";
private Connection conn;
private Statement stat;
public DBUtils() throws SQLException, ClassNotFoundException
{
Class.forName(DB_DRIVER);
this.conn = DriverManager.getConnection(DB_URL,DB_USER,DB_PAS);
this.stat = this.conn.createStatement();
}
用官网提供的OJDBC6链接数据库出错,换用ojdbc14.jar不改代码就可以正常访问,但会影响其他程序的使用,jdk是1.6.43,以下是ojdbc6运行时报的错误:
Exception in thread "main" java.sql.SQLException: Undefined Error
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:412)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:531)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at cn.sjl.oracle.conn.DBUtils.<init>(DBUtils.java:29)
at cn.sjl.database.test.TestConnectOracle.main(TestConnectOracle.java:12)
Caused by: oracle.net.ns.NetException: Undefined Error
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:385)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1042)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:301)
... 8 more 展开
展开全部
driver用这个:
oracle.jdbc.OracleDriver
private final String DB_DRIVER = "oracle.jdbc.OracleDriver";
private final String DB_URL ="jdbc:oracle:thin:@127.0.0.1:1521:orcl";
private final String DB_USER="test";
private final String DB_PAS="111111";
private Connection conn;
private Statement stat;
public DBUtils() throws SQLException, ClassNotFoundException
{
Class.forName(DB_DRIVER);
this.conn = DriverManager.getConnection(DB_URL,DB_USER,DB_PAS);
this.stat = this.conn.createStatement();
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
TableDI
2024-07-18 广告
2024-07-18 广告
`VLOOKUP` 匹配出错误的数据通常是由于以下几个原因:1. **查找值错误**:输入的查找值与数据源中的值不匹配,可能是因为拼写错误、大小写不一致或存在不可见的字符。2. **查找区域设置错误**:查找区域的首列必须包含要查找的值,且...
点击进入详情页
本回答由TableDI提供
展开全部
你的监听服务listener开了吗?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
报错的是sql异常,你SQL怎么写的?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询