oracle java.sql.SQLException: Io 异常: 指定了未知主机
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34639459/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
java.sql.SQLException: Io exception: Unknown host specified
提问by Divya Rao
I have a server name, port number, database name, domain, username, and password. I entered the connection string using the below format:
我有服务器名称、端口号、数据库名称、域、用户名和密码。我使用以下格式输入了连接字符串:
jdbc:oracle:thin:@//serverName:portNumber//domain
But got the below error:
但得到以下错误:
java.sql.SQLException: Io exception: Unknown host specified
java.sql.SQLException: Io 异常: 指定了未知主机
How do I specify the connection string ?
如何指定连接字符串?
回答by John DeFauw
Without seeing your connection string it is difficult to tell what might be the actual problem, but the error is basically letting you know it cannot reach whatever machine you specified. Here is a good link regarding Oracle connection strings using Java:
如果没有看到您的连接字符串,很难判断可能是实际问题,但错误基本上是让您知道它无法到达您指定的任何机器。这是关于使用 Java 的 Oracle 连接字符串的一个很好的链接:
https://docs.oracle.com/cd/E11882_01/appdev.112/e13995/oracle/jdbc/OracleDriver.html
https://docs.oracle.com/cd/E11882_01/appdev.112/e13995/oracle/jdbc/OracleDriver.html
回答by Raghavendra
jdbc:oracle:thin:@DBhost:DBport:DBname
jdbc:oracle:thin:@DBhost:DBport:DBname
回答by Venu A Positive
Path is wrong Just run this: jdbc:oracle:thin://@serverName:portNumber/databaseName
路径错误就运行这个:jdbc:oracle:thin://@serverName:portNumber/databaseName