Oracle connection Io exception: The Network Adapter cocould not

Source: Internet
Author: User

Today, The following exception occurs when Tomcat connects to the Oracle database: org. apache. commons. dbcp. SQLNestedException: Cannot create PoolableConnectionFactory (Io exception: The Network Adapter cocould not establish the connection)

Specific Error

Java. SQL. SQLRecoverableException: Io exception: The Network Adapter cocould not establish the connection
At oracle. jdbc. driver. SQLStateMapping. newSQLException (SQLStateMapping. java: 101)
At oracle. jdbc. driver. DatabaseError. newSQLException (DatabaseError. java: 112)
At oracle. jdbc. driver. DatabaseError. throwSqlException (DatabaseError. java: 173)
At oracle. jdbc. driver. DatabaseError. throwSqlException (DatabaseError. java: 229)
At oracle. jdbc. driver. DatabaseError. throwSqlException (DatabaseError. java: 458)
At oracle. jdbc. driver. T4CConnection. logon (T4CConnection. java: 411)
At oracle. jdbc. driver. PhysicalConnection. <init> (PhysicalConnection. java: 490)
At oracle. jdbc. driver. T4CConnection. <init> (T4CConnection. java: 202)
At oracle. jdbc. driver. T4CDriverExtension. getConnection (T4CDriverExtension. java: 33)
At oracle. jdbc. driver. OracleDriver. connect (OracleDriver. java: 474)
At java. SQL. DriverManager. getConnection (Unknown Source)
At java. SQL. DriverManager. getConnection (Unknown Source)
At chap6.DBUtil. getConnection (DBUtil. java: 14)
At chap6.StatementDemo. main (StatementDemo. java: 15)
Java. SQL. SQLException: Driver error or connection failure!
At chap6.DBUtil. getConnection (DBUtil. java: 20)
At chap6.StatementDemo. main (StatementDemo. java: 15)

Solution 1

Later, three ports 8080,800, 8005 and were opened in the firewall. The problem was solved.


Solution 2

Oracle's thin connection is divided into two types: SID and service name. The difference between the two is how the server configures the SID or service name. After configuring the database, you can

The Code is as follows: Copy code

D: oracleproduct10.2.0db _ 1 NETWORKADMIN

Find the tnsnames. ora file in the directory and check the parameters.

Confirm the method based on the preceding data configuration.

A. in SID mode, the JDBC connection form is

The Code is as follows: Copy code

String url = "jdbc: oracle: thin: @ // 192.168.10.105: 1522: uportal ";

Note that when you connect to a data instance, use the colon:

B. For the SERVICE mode, the JDBC connection data format is

The Code is as follows: Copy code

String url = "jdbc: oracle: thin: @ // 192.168.10.105: 1522/uportal ";

Note that when you connect to a data instance, the slashes/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.