Oracle自代的线程池
第一个类:
/**
*
* 存放oracle数据库的链接信息。
*
* @author ZhongHuiQiang
*
*/
public interface IOracleDAOInfor {
String DB_SERVER_HOSET = "localhost";
String DB_SERVER_NAME = "ppoo";
String DB_USER_NAME = "system";
String DB_USER_PASSWORD = "ppoo";
String DB_URL = "jdbc:oracle:thin:@" + DB_SERVER_HOSET + ":1521:"
+ DB_SERVER_NAME;
}
第二个类(测试):
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import oracle.jdbc.pool.OracleConnectionCacheImpl;
/**
*
* 可以获得数据库连接的Connection。<br>
* 以及关闭指定的数据库Connection`ResultSet和Statement<br>
*
* @author ZhongHuiQiang
*
*/
public class OracleDAOFactory implements IOracleDAOInfor {
/**
*
* 得到一个Connection对象
*
* @return java.sql.Connection
*/
public static Connection getConn() {
Connection conn = null;
try {
OracleConnectionCacheImpl occi = new OracleConnectionCacheImpl();
occi.setURL(DB_URL);
occi.setUser(DB_USER_NAME);
occi.setPassword(DB_USER_PASSWORD);
occi.setMinLimit(2); // 最小连接数
occi.setMaxLimit(10); // 最大连接数
conn = occi.getConnection();
} catch (SQLException e) {
System.out.println("数据库链接有问题,这个在OracleDAO.java类中");
}
return conn;
}
/**
*
* 关闭指定的结果集
*
* @param rs
* 要关闭的ResultSet
*/
public static void closeResultSet(ResultSet rs) {
try {
if (rs != null) {
rs.close();
&nbs
相关文档:
oracle 数据库里查看表空间施用景况;
oracle表空间的事儿情况要常常查看,正常闲空比率过低的时分就应该思考增大表看空间了。查看步骤如次SQL:
步骤1:
select dbf.tablespace_name,
dbf.totalspace "总量(M)",
dbf.totalblocks as 总块数,
dfs.freespace "余下总量(M)",
dfs.freeblocks "余下块数",
(dfs.f ......
如果仅仅是lock,以下语句可以发现所有用户锁 :
SELECT s.username,
decode(l.type, 'TM', 'TABLE LOCK', 'TX', 'ROW LOCK', NULL) LOCK_LEVEL,
o.owner,
o.object_name,
&n ......
SQL> select dbms_metadata.get_ddl('PROCEDURE','PRO2','SCOTT') text from dual;
TEXT
----------------------------------------
CREATE OR REPLACE PROCEDURE "SCOTT"."P
RO2"
is
begin
dbms_output.put_line('wangpeng up');
end;
SQL> select dbms_metadata.get_ddl('PROCEDURE','PRO1','SCOTT') te ......
转载
from: http://cid-4e5d038451e31a25.spaces.live.com/blog/cns!4E5D038451E31A25!140.entry
create or replace procedure P_QuerySplit(
sqlscript varchar2, --表名/SQL语句
pageSize integer, ......
oracle发送邮件存储过程:
create or replace procedure bsd_sendemail(
p_receiver varchar2,
p_sub varchar2,
p_txt varchar2)
is
p_user varchar2(30):='';
p_pass varchar2(30):='';
p_sendor varchar2(20):='Gnie';
p_server varchar2(20):='Mail_Server_IP';
p_port number:=25;
p_need_smtp number:=0;
p ......