如何解决“ IO-fout:无效的连接字符串格式,有效的格式是:“ host:port:sid””错误?

时间:2019-09-25 06:16:53

标签: java ojdbc

我正在尝试与我的一个数据库建立数据库连接。但这让我出错:
IO-fout: Invalid connection string format, a valid format is: "host:port:sid"

我对此一无所知。

1。我根据项目要求将数据库升级到12c
2.已从ojdbc14.jar更新为ojdbc6
3.也尝试添加sid,但仍然出现相同的错误

url = "jdbc:oracle:thin:@abc";                      
DriverManager.registerDriver(new OracleDriver());   
res =DriverManager.getConnection(url,userName,password);   

错误:

java.sql.SQLRecoverableException: IO-fout: Invalid connection string format, a valid format is: "host:port:sid"    
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:673)   
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:711)   
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:385)   
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:30)   
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:558)   
at java.sql.DriverManager.getConnection(Unknown Source)   
at java.sql.DriverManager.getConnection(Unknown Source)

0 个答案:

没有答案