Unable to connect to any hosts due to exception
java.sql.SQLException: Unable to connect to any hosts due to exception: java.lang.ArrayIndexOutOfBoundsException: 40
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1797)
at com.mysql.jdbc.Connection.
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:361)
at java.sql.DriverManager.getConnection(DriverManager.java:525)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at org.apache.commons.dbcp.DriverManagerConnectionFactory.createConnection(DriverManagerConnectionFactory.java:48)
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:290)
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:771)
at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:95)
at com.community.util.ConnectionPool.getConnection(ConnectionPool.java:56)
at com.community.manager.ModelManager.getConnection(ModelManager.java:16)
at com.community.manager.MovieManager.main(MovieManager.java:48)
連結mysql的時候發現,資料庫名稱跟這個異常直接相關,
1 資料庫名稱裡不能包含下劃線等特殊字元。
2 資料庫名稱不能太長。
3 如果正常的資料庫名稱也出現這種問題,偶的解決方法是重灌mysql,換資料庫名稱。
最主要的原因是:java的mysql驅動jar和當前的mysql版本不相容造成的,穩定版是 mysql-connector-java-5.0.3.jar
[@more@]來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/750220/viewspace-916682/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to deq...APPException
- nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to localhost:6379ExceptionRedislocalhost
- do not have permission to view information for any of the hosts you requestedViewORM
- Unable to connect to SQL Server ExpressSQLServerExpress
- SVN-Unable to connect to a repository at URL
- Unable to Connect to Database with Oracle Client Software for WindowsDatabaseOracleclientWindows
- unable to connect to converter enterprise serverServer
- JNDI naming exception: Naming exception trying to connect to: t3://localhosException
- *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[APPException
- [GuzzleHttp\Exception\RequestException] cURL error 60: SSL certificate problem: unable to get localHTTPExceptionError
- 分析11.2.0.3 rac CRS-1714:Unable to discover any voting files
- ORA-15055 Unable to Connect to ASM When Starting an InstanceASM
- Counld not connect to ASM due to following error,ora-12547:TNS:lost comactASMErrorMac
- 如何理解 new (...args: any[]) => any
- TNS-12535 Unable To Connect To Remote Database using certain ApplicationsREMDatabaseAIAPP
- ASM例項啟動報錯:ORA-29701 :unable to connect to Cluster ManagerASM
- ORA-15055: unable to connect to ASM instance 造成 RAC的db不能啟動ASM
- ORA-15055 ORA-12549 Unable To Connect To ASM Instance問題ASM
- iOS-程式錯誤導致App閃退了怎麼辦?Terminating app due to uncaught exception...iOSAPPException
- 【RAC】ORA-15055: unable to connect to ASM instanceORA-12547: TNS:lost contactASM
- hosts.allow與hosts.deny設定
- any和anyObjectObject
- ExceptionException
- ORA-15055: unable to connect to ASM instanceORA-12547: TNS:lost contact(轉載)ASM
- Ubuntu修改hostsUbuntu
- Ubuntu 修改hostsUbuntu
- 【Linux】/etc/hosts.deny與/etc/hosts.allowLinux
- TypeScript Any型別TypeScript型別
- jasmine.any(Function)ASMFunction
- Swift中Any & AnyObjectSwiftObject
- 【Azure Redis】部署在AKS中的應用連線Redis時候出現Unable to connect to Redis serverRedisServer
- unable to access ‘https://gitee.com/XXX/XXX.git/‘: Failed to connect to 127.0.0.1 portHTTPGiteeAI127.0.0.1
- Server-side rendering for any React app on any FaaS providerServerIDEReactAPP
- SpokenEnglish01_ When's it due?
- Oracle exceptionOracleException
- Java——ExceptionJavaException
- hosts檔案位置
- ubuntu下配置hostsUbuntu