数据库的Timeout 其实有很多种情况。

一个是执行的超时时间 executionTimeOut,一个是连接的超时时间connectionTimeOut,

还有呢? 等待的超时时间 ReadTimeout。不过很多数据库情况下connectionTimeOut 就是ReadTimeout

props.put("user", userName);
props.put("password", passSecret);
if ("oracle".equals(dbType)) {
//props.put("connectionProperties", "oracle.net.CONNECT_TIMEOUT=10000;oracle.jdbc.ReadTimeout=10000");
props.put("oracle.net.CONNECT_TIMEOUT", "10000");
props.put("oracle.jdbc.ReadTimeout", "10000");
}

String sleepsql = "declare "+
"begin "+
"sys.dbms_lock.sleep(20); "+
"dbms_output.put_line('asfasf');"+
"end;";
String sqlStr =
"select distinct tablespace_name from sys.dba_tables where owner = '"
+ dbInfo.getName().toUpperCase()
+ "' and trim(tablespace_name) is not null";
List<String> dbList = new ArrayList<String>();
PreparedStatement statement = null;
ResultSet rs = null;
try {
CallableStatement callableStatement = conn.prepareCall(sleepsql);
callableStatement.execute();
//conn.setNetworkTimeout(Executors.newCachedThreadPool(), 30000);
} catch (SQLException e) {
e.printStackTrace();
} finally {

}

开始是通过下面的,不过一直就是报错,行不通, 貌似驱动版本不够新。

conn.setNetworkTimeout(Executors.newCachedThreadPool(), 30000);

有关数据库的锁:

http://www.cnblogs.com/cqubityj/archive/2012/06/16/2551947.html

http://www.cnblogs.com/leemoby/p/3583428.html

LOCK TABLE iempeam.t_aa IN EXCLUSIVE MODE

SELECT * FROM  iempeam.t_aa  TABLOCKX

数据库的Timeout的更多相关文章

  1. SqlException:ConnectionTimeout Expired. The timeout period elapsed during the post-login phase

    linux系统部署.netcore程序后,访问某台sqlserver 2008 R2数据库 Connection Timeout Expired. The timeout period elapsed ...

  2. 34、使用Python操作MySql数据库和MsSql数据库

    一.数据库的安装和连接 1. PyMySQL的安装 pip install pymysql 2 .python连接数据库 import pymysql db = pymysql.connect(&qu ...

  3. PAIP.MYSQL SLEEP 连接太多解决

    PAIP.MYSQL SLEEP 连接太多解决 作者Attilax  艾龙,  EMAIL:1466519819@qq.com  来源:attilax的专栏 地址:http://blog.csdn.n ...

  4. kettle 数据库连接中断重置

    项目适用kettle作为etl工具,源数据库为mysql库,目标库为oracle.在持续的循环调度中,经常发现oracle的数据库连接中断,需要重置. 具体报错信息如下: INFO  26-12 23 ...

  5. redis实现spring-redis-data的入门实例

    redis的客户端实现.主要分为spring-redis-data .jredis. 记录下spring-redis-data的学习心得:spring-redis-data 中我目前主要用了它的存.取 ...

  6. Redis键迁移

    Redis键迁移   在使用Redis的过程中,很多时候我们会遇到需要进行键迁移的问题,需要将指定Redis中的指定数据迁移到其他Redis当中,键迁移有三种方法,我们来进行一一介绍. 一.move ...

  7. Redis学习笔记--常用命令

    以下为本人学习Redis的备忘录,记录了大部分常用命令 1.客户端连接redis服务端: ===启动Redis服务端 redis-server /yourpath/redis.conf ===启动Re ...

  8. NoSQL - KVstore -Redis

    Redis键迁移 在使用Redis的过程中,很多时候我们会遇到需要进行键迁移的问题,需要将指定Redis中的指定数据迁移到其他Redis当中,键迁移有三种方法,我们来进行一一介绍. 一.move mo ...

  9. SQLite3 of python

    SQLite3 of python 一.SQLite3 数据库 SQLite3 可使用 sqlite3 模块与 Python 进行集成,一般 python 2.5 以上版本默认自带了sqlite3模块 ...

随机推荐

  1. 移动端前端笔记 — 遇到的常见JS与CSS问题及解决方法 ( 摘自zdwzdwzdw)

    笔者接触移动前端快一年了,特将平时的一些笔记整理出来,希望能够给需要的人一些小小的帮助.同时也由于笔者的水平有限,虽说都是笔者遇到过使用过的,但文中可能也会出现一些问题或不严谨的地方,望各位指出,不胜 ...

  2. css3 2D动画的基本用法和介绍

    <style> body{height:400px;border:1px solid #000;} .box{width:90px;height:30px;border:1px solid ...

  3. Affinity Propagation Algorithm

    The principle of Affinity Propagation Algorithm is discribed at above. It is widly applied in many f ...

  4. 斯坦福公开课:Statistical Learning中做错的选择题

    4.4 R1 In which of the following problems is Case/Control Sampling LEAST likely to make a positive i ...

  5. socket 通信

    type TWinSocketStringStream = class(TWinSocketStream) public function ReadString(nMaxLength: Integer ...

  6. devise 小项目(一)

    Devise源于Warden,而warden是一个基于Rack的验证权限gem,不过,使用devise实际并不需要任何关于warden的知识. 如果你之前有一些其他类似的维护验证权限功能的gem的使用 ...

  7. AngularJs 时间控件

    <div class="form-group col-sm-4 clearfix"> <label class="col-sm-5 control-la ...

  8. vi命令模式下快速注释代码的方法

    进入http://www.vim.org/scripts/script.php?script_id=1528 点击这个链接下载comments.vim这个插件 然后把它放入到./vim/plugin下 ...

  9. hdu 2896 AC自动机

    // hdu 2896 AC自动机 // // 题目大意: // // 给你n个短串,然后给你q串长字符串,要求每个长字符串中 // 是否出现短串,出现的短串各是什么 // // 解题思路: // / ...

  10. 网页中插入FLASH(swf文件)的html代码

    一.简单插入flash图像<embed src="你的flash地址.swf"width="300" height="220"> ...