用eclipse连接oracle11g时出现问题,总觉得代码没问题,是不是有什么要配置的,试过多种代码连接都是这错 80
我导入的是D:\app\marje\product\11.2.0\dbhome_1\jdbc\lib中的ojdbc6_gimportjava.sql.Connection...
我导入的是D:\app\marje\product\11.2.0\dbhome_1\jdbc\lib中的ojdbc6_g
import java.sql.Connection;import java.sql.DriverManager;import java.sql.SQLException;
public class DatabaseConnection { public static final String DBDRIVER = "oracle.jdbc.driver.OracleDriver"; public static final String DBURL = "jdbc:oracle:thin:@localhost:1521:orcl"; public static final String DBUSER = "scott"; public static final String DBPASSWORD = "tiger"; private Connection conn = null;
public DatabaseConnection() { try { Class.forName(DBDRIVER); this.conn = DriverManager.getConnection(DBURL, DBUSER, DBPASSWORD); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } }
public Connection getConnection() { return this.conn; }
public void close() { if (this.conn != null) { try { this.conn.close(); } catch (SQLException e) { e.printStackTrace(); } } }}出现如下错误:
a [Loracle.jdbc.driver.SQLStateMapping;@b03be0low: 0 high: 0 sqlState: 00000 sqlException: 0low: 1 high: 1 sqlState: 23000 sqlException: 5low: 18 high: 21 sqlState: 61000 sqlException: 0low: 22 high: 22 sqlState: 42000 sqlException: 8low: 23 high: 23 sqlState: 61000 sqlException: 8low: 24 high: 35 sqlState: 61000 sqlException: 0low: 50 high: 68 sqlState: 61000 sqlException: 0等。。写不下了 展开
import java.sql.Connection;import java.sql.DriverManager;import java.sql.SQLException;
public class DatabaseConnection { public static final String DBDRIVER = "oracle.jdbc.driver.OracleDriver"; public static final String DBURL = "jdbc:oracle:thin:@localhost:1521:orcl"; public static final String DBUSER = "scott"; public static final String DBPASSWORD = "tiger"; private Connection conn = null;
public DatabaseConnection() { try { Class.forName(DBDRIVER); this.conn = DriverManager.getConnection(DBURL, DBUSER, DBPASSWORD); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } }
public Connection getConnection() { return this.conn; }
public void close() { if (this.conn != null) { try { this.conn.close(); } catch (SQLException e) { e.printStackTrace(); } } }}出现如下错误:
a [Loracle.jdbc.driver.SQLStateMapping;@b03be0low: 0 high: 0 sqlState: 00000 sqlException: 0low: 1 high: 1 sqlState: 23000 sqlException: 5low: 18 high: 21 sqlState: 61000 sqlException: 0low: 22 high: 22 sqlState: 42000 sqlException: 8low: 23 high: 23 sqlState: 61000 sqlException: 8low: 24 high: 35 sqlState: 61000 sqlException: 0low: 50 high: 68 sqlState: 61000 sqlException: 0等。。写不下了 展开
1个回答
2013-06-10
展开全部
ojdbc5和ojdbc6,要其中一个版本
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询