昨天看了下資料庫連線池,有很多開源的連線池,為了方便就使用了tomcat中帶的連線池,
開始找了幾篇文章,都沒有弄成功,tomcat圖形管理介面建立連線池的也不好用,
後來在網上找了一篇tomcat5.5的配置文章,總算是解決了,
按照下面的例子試了下,重新整理幾次後就出現了
Cannot get a connection, pool exhausted
後來搜了一下,是連線池被耗盡,
沒有關閉con,
解決辦法有3個:
1重啟tomcat伺服器
2吧maxactive值調大
3在finally中關閉conn
Context initCtx=new InitialContext();
DataSource ds = (DataSource)initCtx.lookup("java:comp/env/jdbc/mysql");
c.getConnection();
out.println("從資料庫查詢資料:<br>");
Statement stmt=conn.createStatement();
ResultSet rs =stmt.executeQuery("select * from userinfo");
while(rs.next())
{
out.println(rs.getString(1));
out.println(rs.getString(2));
}
rs.close();
stmt.close();
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
if(conn!=null)
conn.close();
}
Cannot get a connection, pool exhausted解決辦法
相關文章
- DUBBO Thread pool is EXHAUSTED!thread
- ImportError: cannot import name ‘imresize‘解決辦法ImportError
- Excel匯入資料異常Cannot get a text value from a numeric cell解決辦法Excel
- zabbix_get :command not found 解決辦法
- 解決 TypeError: Type aliases cannot be used with isinstance(). 辦法Error
- Android Studio 出現“Cannot resolve symbol” 解決辦法AndroidSymbol
- FileZilla:425 Can't open data connection for transfer of解決辦法
- org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection 解決辦法SpringFrameworkJDBCOTGExceptionAI
- mac無法充電解決辦法!看來get下吧!Mac
- mongodb錯誤解決辦法-bash: ./mongod: cannot execute binary file: Exec format errorMongoDBORMError
- Laravel 安裝 sail時ubuntu軟體源很慢或者connection failed 解決辦法LaravelAIUbuntu
- github慢解決辦法Github
- Namespoace Terminating 解決辦法
- 檔案無法粉碎解決辦法
- 公寓噪音的解決辦法
- height:100%失效解決辦法
- go get報錯connect: connection refusedGo
- 記vscode無法啟動解決辦法VSCode
- jedis異常:Could not get a resource from the pool
- multiprocessing pool AttributeError: Can't get attribute 'func'Error
- flutter pub get 無法生成 .ios 資料夾解決FlutteriOS
- -bash: XXX: command not found解決辦法
- cnpm link 報錯解決辦法NPM
- mysql事件關閉解決辦法MySql事件
- IDEA 找不到包解決辦法Idea
- 資料傾斜解決辦法
- SpringBoot 迴圈引用解決辦法Spring Boot
- VScode 更新失敗解決辦法VSCode
- npm install 失敗解決辦法NPM
- github訪問受限解決辦法Github
- 跨域問題解決辦法跨域
- SqlServer鎖表解鎖解決辦法SQLServer
- ModuleNotFoundError: No module named ‘DBUtils‘解決辦法Error
- Failed to get D-Bus connection: Operation not permittedAIMIT
- zblogphp提示“ Call to undefined function openssl_pkey_get_public()”的原因和解決辦法PHPUndefinedFunction
- 解決cannot find module providing package或cannot find main modulePackageAI
- tomcat埠被佔用解決辦法Tomcat
- Vue 下 ESLint 的 error 解決辦法VueEsLintError
- 表碎片起因及解決辦法(zt)