java设置的监听器错误,java.sql.SQLException:侦听器拒绝连接时出现以下错误:ORA-12519,TNS:找不到合适的服务处理程序...

I am passing Resultset object to each thread. Each thread is connecting to the database and inserting data. Untill thread 110 it is working fine. After it crosses 111 thread it throws the above exception.

I am using oracle 11g.

My sample Thread code is:

class MyThreadClass implements Runnable

{

public Connection connection;

public Statement statement2;

public ResultSet rs2;

public String cookie;

public MyThreadClass(ResultSet rs1)

{

rs2=rs1;

}

public void run()

{

try

{

cookie=rs2.getString("COOKIE");

driver = "oracle.jdbc.driver.OracleDriver";

url = "jdbc:oracle:thin:@127.0.0.1:1521:xx";

/* connection

statement2.executeUpdate("INSERT INTO visit_header VALUES ('"+cookie+"')");

}

I am not getting how to handle this exception.

解决方案

Your multi-threaded application is opening too many Connections/Sessions. Hence, the listener is dropping and blocking new connections for a while.

Check your DB resource usage first:

SELECT * FROM v$resource_limit WHERE resource_name IN ('processes','sessions');

Check to see if your MAX_UTILIZATION for either your Processes or Sessions is getting too close to the LIMIT_VALUE. If yes, you should either:

Use DB Connection pooling to share Connection objects between threads. Or,

Increase the number of processes/sessions that Oracle can service simultaneously.

Actually, Connection Pooling (#1) should always be done. An application cannot scale up otherwise. Check Apache Commons DBCP for details. For #2, open a new SQL*Plus session as SYSTEM and run:

ALTER system SET processes= scope=spfile;

to increase backend concurrency. Then RESTART the Database. IMPORTANT!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值