java连接oracle
我在连接oracle时出现了下面的错误,请各位大侠给救救
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle://127.0.0.1:1521/book","system","jssbook");
error:
java.sql.SQLException: No suitable driver found for oracle:jdbc://127.0.0.1:1521/book
怎么处理?
------解决方案--------------------连接地址url格式错了,这样写试试
jdbc:oracle:@127.0.0.1:1521:book
------解决方案--------------------检查下oracle驱动包加进来没
------解决方案--------------------String URL="jdbc:oracle:thin:@loaclhost:1521:orcl"; //orcl为数据库的SID
数据库连接可以看看下面这个帖子,总结的很不错。
http://topic.csdn.net/u/20080502/09/10b0ca73-bc47-4ba1-9106-7b5489e503f0.html
------解决方案--------------------Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:oracle:thin:@localhost:1521:orcl";