简体   繁体   中英

Java Web Start Application Oracle DB connection Error

Hi I have a file upload application that uploads excel file to our oracle database.

Here's my code in connecting to our database:

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;

Note that on our VLAN and other VLAN it works smoothly and it's fine.

My problem is when I try it on our warehouse VLAN it doesn't work at all. It cannot connect to our Oracle database.

Here's my error:

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

According to our network team there are no restrictions on the warehouse VLAN and I can even ping db servers using warehouse VLAN. What can be the problem here?

Check IP and port number of your server.

connection = DriverManager.getConnection(
"jdbc:oracle:thin:@SERVERNAME:PORTNUMBER:SERVERID","USERNAME","PASSWWORD");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM