数据库的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. C# this和base的使用

    namespace THISORBASE { //参考地址:http://blog.sina.com.cn/s/blog_7300c7d90100rs20.html /*这个时候,派生类和基类的_st ...

  2. yaf框架学习笔记

    1.yaf框架支持简单的试图引擎,并且支持用户自定义视图引擎,比如smarty. 2.Yaf_Request_Http::getQuery  ,Yaf_Request_Http::getQuery ( ...

  3. angular中ng-include失效的原因

    使得angular的ng-include指令失效的原因有两个: 例如:在demo.html中的代码<div ng-include = "'demo1.html'">&l ...

  4. Java变量自增和自减运算符的用法

    1.后加加(num++): 先输出运算结果再加加: public static void main(String[] args){ int num=10; int  p1=num++; System. ...

  5. rsync+inotify实现远程数据备份

    一.rsync的基本介绍 1.  什么是rsync Rsync是一款开源的.快速的.多功能的.可以实现增量的本地货远程数据镜像同步备份的优秀工具,Rsync使用与unix,linux,windows等 ...

  6. java读取properties配置文件总结

    java读取properties配置文件总结 在日常项目开发和学习中,我们不免会经常用到.propeties配置文件,例如数据库c3p0连接池的配置等.而我们经常读取配置文件的方法有以下两种: (1) ...

  7. block的复习

    main.m // //  main.m //  8A10.Block的复习 // //  Created by huan on 16/2/8. //  Copyright © 2016年 huanx ...

  8. C#自旋的艺术

    CODE1: while (status == ServerStatus.Started) { if (*TaskLocker > 0) { for (int i = 0; i != *Leve ...

  9. Hyper-V初涉:Hyper-V虚拟机常规操作

    a. 连接到虚拟机与开机 在Hyper-V管理器中双击待启动的虚拟机或在待启动的虚拟机上右键选择"启动"即可完成连接虚拟机的操作. 若此时虚拟机正在运行则直接进入虚拟机界面,若虚拟 ...

  10. ubuntu网络配置&&ubuntu apt-get错误解决办法

    网络配置: 方式1:网卡通过DHCP自动获取IP地址 $ sudo gedit /etc/network/interfaces # 修改文件/etc/network/interfaces如下文 #-- ...