myeclipse连接数据库
StringClass_ForName="oracle.jdbc.driver.OracleDriver";StringDriver_URL="jdbc:oralce:t...
String Class_ForName="oracle.jdbc.driver.OracleDriver";
String Driver_URL = "jdbc:oralce:thin:@localhost:1521:MyTestOracle";
String ORA_username ="scott";
String ORA_pwd = "tiger";
String select_login = "select * from userinfo where username=? and password=?";
try {
Class.forName(Class_ForName);
conn = DriverManager.getConnection(Driver_URL,ORA_username,ORA_pwd);
pstmt = conn.prepareStatement(select_login);
pstmt.setString(1, username);
pstmt.setString(2, pwd);
rs = pstmt.executeQuery();
if(rs.next()){
return i=1;
}else{
return i;
}
当运行到conn = DriverManager.getConnection(Driver_URL,ORA_username,ORA_pwd);这句时就报错:
java.sql.SQLException: No suitable driver found for jdbc:oralce:thin:@localhost:1521:MyTestOracle;
我已经添加了驱动!还请各位帮帮忙! 展开
String Driver_URL = "jdbc:oralce:thin:@localhost:1521:MyTestOracle";
String ORA_username ="scott";
String ORA_pwd = "tiger";
String select_login = "select * from userinfo where username=? and password=?";
try {
Class.forName(Class_ForName);
conn = DriverManager.getConnection(Driver_URL,ORA_username,ORA_pwd);
pstmt = conn.prepareStatement(select_login);
pstmt.setString(1, username);
pstmt.setString(2, pwd);
rs = pstmt.executeQuery();
if(rs.next()){
return i=1;
}else{
return i;
}
当运行到conn = DriverManager.getConnection(Driver_URL,ORA_username,ORA_pwd);这句时就报错:
java.sql.SQLException: No suitable driver found for jdbc:oralce:thin:@localhost:1521:MyTestOracle;
我已经添加了驱动!还请各位帮帮忙! 展开
4个回答
展开全部
Oracle
oracle.jdbc.driver.OracleDriver
jdbc:oracle:thin:@hostname:1521:<SID>
没有合适的驱动 ,驱动有问题
oracle.jdbc.driver.OracleDriver
jdbc:oracle:thin:@hostname:1521:<SID>
没有合适的驱动 ,驱动有问题
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
build_path 里添加驱动包的路径了吗?
你加的是ORACLE 的驱动包吗?
你加的是ORACLE 的驱动包吗?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
看看添加的是不是oralce的库
版本上也有不同
版本上也有不同
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询