java.sql.SQLException: Io 異常: The Network Adapter could not establish the connec
錯誤如下:
java.sql.SQLException: Io 異常: The Network Adapter could not establish the connection
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at java.sql.DriverManager.getConnection(DriverManager.java:525)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at pack.java.connection.demo.BaseDao.getConnection(BaseDao.java:35)
at pack.java.connection.demo.BaseDao.<init>(BaseDao.java:23)
at pack.java.connection.demo.BaseDao.main(BaseDao.java:98)
Oracle 使用者名稱或密碼錯誤!
解決方案:
像這種介面卡的錯誤,有很多原因. 比如驅動程式 或者URL寫錯..
還有,使用者名稱和密碼;.
如果這些確定沒有寫錯,然後再檢查你的oracle安裝目錄下,比如:F:\oracle\product\10.2.0\db_1\NETWORK\ADMIN
這個目錄下的
listener.ora
tnsnames.ora
這兩個檔案,開啟 listener.ora檔案.
# tnsnames.ora Network Configuration File: F:\oracle\product\10.2.0\db_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =改成你的計算機名稱)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
然後,開啟tnsnames.ora檔案.把host改成機器名稱..因為oracle預設是ip地址..如果你的ip地址變動的話,則自然不匹配原因的ip地址.則會發生錯誤.
# listener.ora Network Configuration File: F:\oracle\product\10.2.0\db_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = F:\oracle\product\10.2.0\db_1)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = 改成你的計算機名稱)(PORT = 1521))
)
)
最後把:
private final String DRIVER = "oracle.jdbc.driver.OracleDriver";
private final String URL = "jdbc:oracle:thin:@localhost:1521:ORCL";
把localhost替換成機器名;
執行..問題解決..
相關文章
- oracle出異常:Io 異常: The Network Adapter could not establish the connection 解決辦法OracleAPT
- SQLDeloper IO 錯誤: The Network Adapter could not establish the connectionSQLAPT
- IO Exception: The Network Adapter Could Not Establish a Connection_604155.1ExceptionAPT
- 關於The Network Adapter could not establish connection。APT
- sql developer連結不上oracle 報 The Network Adapter could not establish the connectionSQLDeveloperOracleAPT
- java.sql.SQLException: Io 異常: Connection refusedJavaSQLException
- tomcat連線池不夠-java.sql.SQLException: Io 異常: Connection resetTomcatJavaSQLException
- tomcat 啟動應用報錯:java.sql.SQLException: Io 異常: Connection resetTomcatJavaSQLException
- java.sql.SQLException: No value specified for parameter 1 異常分析JavaSQLException
- jedis異常:Could not get a resource from the pool
- Java新增構造方法異常異常——Could not autowire. there is more than one bean of '' typeJava構造方法Bean
- 日誌異常,IO,CPU的檢查
- lightdb WARNING: could not establish connection after 30000 ms
- 請教:castor MappingException: Could not find the class異常ASTAPPException
- android adapter getView方法中return null發生的異常AndroidAPTViewNull
- Could not initialize class sun.awt.X11GraphicsEnvironment異常處理
- java.lang.IllegalArgumentException: Could not find class異常解決方式JavaException
- 異常org.hibernate.QueryException: could not resolve property的原因Exception
- Idea資料庫引入異常:java.sql.SQLException: The server time zone value ‘Öйú±ê׼ʱ¼ä‘ is unrecognizedIdea資料庫JavaSQLExceptionServerZed
- Linux,Network manager 導致節點異常重啟Linux
- 異常資訊解決:Could not obtain transaction-synchronized Session for current threadAIsynchronizedSessionthread
- ibatis resultMap引數填充異常:java.sql.SQLException: Column 'XXX' not found.BATJavaSQLException
- Java程式設計基礎20——異常&IO(File類)Java程式設計
- Mysql異常刨析:Could not commit JDBC transaction;No operations allowed after statement closedMySqlMITJDBC
- java.sql.SQLException:IO 錯誤:Socket read timed out !JavaSQLException
- 異常解決java.io.IOException: invalid constant type: 15JavaException
- 異常篇——異常處理
- 異常和異常呼叫鏈
- ORACLE TNS Io異常End of TNS data channel&ORA-12518Oracle
- Java 異常(二) 自定義異常Java
- Java checked異常和unchecked異常。Java
- MySQL案例04:Cause: java.sql.SQLException: Could not retrieve transaction read-only status from serverMySqlJavaExceptionServer
- 異常-編譯期異常和執行期異常的區別編譯
- jdbc連線sql server 出現 java.sql.SQLException: Network error IOException: Connection refused:JDBCSQLServerJavaExceptionError
- 異常-throws的方式處理異常
- 異常處理與異常函式函式
- jmu-Java-06異常-01-常見異常Java
- hibernate異常之--count查詢異常