嗨,我有一个文件上传应用程序,可以将 excel 文件上传到我们的 oracle 数据库。
这是我连接数据库的代码:
Class.forName("oracle.jdbc.driver.OracleDriver");
String serverName = null;
String sid = null;
String portNumber = "1521";
String username = "*****";
String password = "*****";
serverName = '00.00.00.000'
sid = 'FPROD0'
String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
Connection conn = null;
请注意,在我们的 VLAN 和其他 VLAN 上,它可以顺利运行并且很好。
我的问题是当我在我们的仓库 VLAN 上尝试它时它根本不起作用。它无法连接到我们的 Oracle 数据库。
这是我的错误:
java.sql.SQLException: The Network Adapter could not establish the connection
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:199)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:480)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:413)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:508)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:203)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:510)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at digicare.tracking.serial.BulkUpload.DatabaseConnection.OracleConnection.GetDB(OracleConnection.java:59)
at digicare.tracking.serial.BulkUpload.DatabaseConnection.OracleConnection.main(OracleConnection.java:17)
at digicare.tracking.serial.BulkUpload.UploadProgress$1read2.run(UploadProgress.java:116)
at java.lang.Thread.run(Unknown Source)
Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection
at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:328)
at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:421)
at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:630)
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:206)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:966)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:292)
... 10 more
Caused by: java.net.SocketException: Malformed reply from SOCKS server
at java.net.SocksSocketImpl.readSocksReply(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:127)
at oracle.net.nt.ConnOption.connect(ConnOption.java:126)
at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:306)
... 15 more
根据我们的网络团队,仓库 VLAN 没有任何限制,我什至可以使用仓库 VLAN ping db 服务器。这里有什么问题?