[jboss-user] [JBossCache] - Re: Urgent- Socket error when adding object to DB using JDBC

2006-10-12 Thread [EMAIL PROTECTED]
Even if you don't use a full app server, there are several connection pooling 
libraries you could use:

http://www.primrose.org.uk/home.jsp
http://sourceforge.net/projects/c3p0
http://jakarta.apache.org/commons/dbcp/

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3977895#3977895

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3977895
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBossCache] - Re: Urgent- Socket error when adding object to DB using JDBC

2006-10-11 Thread malek256
We are not using transactions.

Keeping the connections open and reusable was the intent; our information 
obtained earlier was that this scenario could not run at all and we needed to 
use a connection pool - however that does not suit our purpose as it would 
require significant alteration of the existing code OR use of a JNDI interface 
plus app server which is 100% against the scope of what we are trying to 
achieve.



View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3977548#3977548

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3977548
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBossCache] - Re: Urgent- Socket error when adding object to DB using JDBC

2006-10-11 Thread [EMAIL PROTECTED]
Fair enough.  The problem here though is that when using transactions that span 
multiple calls, this breaks things.  

A proper solution would be to use a rudimentary internal pool (HashMap of open 
conns) for the non-managed factory.

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3977554#3977554

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3977554
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBossCache] - Re: Urgent- Socket error when adding object to DB using JDBC

2006-10-11 Thread malek256
Agreed - however we are doing limited, time-bound feasibility studies of many 
competing combinatorials in order to see if we should make a recommendation for 
a specific direction.  If this is the direction we take, a connection pool is 
mandatory - but likely would be the job of the container / app server we select.

Thanks much for your assistance.

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3977674#3977674

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3977674
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBossCache] - Re: Urgent- Socket error when adding object to DB using JDBC

2006-10-10 Thread malek256
Adding the following additional change allowed for 10,000 consecutive updates 
without error.

 public NonManagedConnectionFactory(String url, String usr, String pwd)
  {
 this.url = url;
 this.usr = usr;
 this.pwd = pwd;
 
 // what if I do a connection right off?
 // BEGIN MODIFICATION:  GJF - October 10, 2006
 Connection con = getConnection();
 try {
con.setAutoCommit(false);
 } catch( SQLException e ){
 // don't care
 }
 // END MODIFICATION
  }


View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3977285#3977285

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3977285
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBossCache] - Re: Urgent- Socket error when adding object to DB using JDBC

2006-10-10 Thread [EMAIL PROTECTED]
What does this change actually do?  It just seems to create a new connection 
and store it in threadlocal when the cacheloader  is constructed, and that's it.

So all it does is store a conn for a particular thread (the one that starts the 
cache).  Other threads will still have to call getConnection() each time with a 
prepare().

Am I missing something, how does this result in being able to deal with 
capacity better?

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3977301#3977301

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3977301
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBossCache] - Re: Urgent- Socket error when adding object to DB using JDBC

2006-10-10 Thread malek256
[EMAIL PROTECTED] wrote : What does this change actually do?  It just seems 
to create a new connection and store it in threadlocal when the cacheloader  is 
constructed, and that's it.
  | 
  | So all it does is store a conn for a particular thread (the one that starts 
the cache).  Other threads will still have to call getConnection() each time 
with a prepare().
  | 
  | Am I missing something, how does this result in being able to deal with 
capacity better?

Correct, note that it also enforces setting autocommit off.

I am only fleetingly familiar with this code base - however I cannot deny the 
evidence of the tests. 

I can (now) successfully run up to 50,000 stores without issue.  This does in 
fact seem to address the issue.

Perhaps you can identify the full reason as to why.

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3977343#3977343

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3977343
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBossCache] - Re: Urgent- Socket error when adding object to DB using JDBC

2006-10-10 Thread [EMAIL PROTECTED]
Ah, here's a reason why - are you running your test within a transaction?

Non-tx-related calls call cf.close(), which results in:


  | public void close(Connection con)
  |   {
  |  if(con != null  con != connection.get())
  |  {
  | try
  | {
  |con.close();
  |if(log.isTraceEnabled())
  |{
  |   //log.trace(closed non tx connection:  + con);
  |}
  | }
  | catch(SQLException e)
  | {
  |log.warn(Failed to close connection:  + e.getMessage());
  | }
  |  }
  |   }
  | 
  | 

So the connection is only closed if it is NOT the one in ThreadLocal, otherwise 
it is kept open.

If you set the connection in ThreadLocal (and even in getConnection() for that 
matter, rather than prepare()) these connections will not get closed and you 
have some sort of a connection pool going, based on the number of processor 
threads.  I presume this could exhaust your DB backend if these are high.

Could you confirm whether you're using txs in your test?

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3977381#3977381

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3977381
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBossCache] - Re: Urgent- Socket error when adding object to DB using JDBC

2006-10-09 Thread [EMAIL PROTECTED]
Thanks.  See http://jira.jboss.com/jira/browse/JBCACHE-802

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3977016#3977016

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3977016
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBossCache] - Re: Urgent- Socket error when adding object to DB using JDBC

2006-10-05 Thread malek256
After running a large number of tests, all of which repeatably and consistently 
fail in and around approximately 1970-1990 cache updates, I have made the 
following change.

After this change, the code then fails between 3900-4000 updates.  It appears 
that this is a minor defect or at least a suboptimization with the original 
connection code.

The connection is stored into TLS during the 
NonManagedConnectionFactory.prepare() method but it seems it is not put in 
place after the null detect/create code within 
NonManagedConnectionFactory.getConnection.

I urge you to examine this.

e.g. 
...
 public Connection getConnection()
  {
 Connection con = (Connection) connection.get();
 if(con == null)
 {
try
{
   con = DriverManager.getConnection(url, usr, pwd);
// CODE ADDED HERE
   connection.set(con);
// END CODE MODIFICATION
}
catch(SQLException e)
...

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3976403#3976403

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3976403
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBossCache] - Re: Urgent- Socket error when adding object to DB using JDBC

2006-10-02 Thread [EMAIL PROTECTED]
This is possibly due to the fact that you run out of DB connections.  Are you 
running JBC within an app server?  I'd recommend using a pool of connections.

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3975468#3975468

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3975468
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBossCache] - Re: Urgent- Socket error when adding object to DB using JDBC

2006-09-27 Thread mitra123
By the way I am running on WinXP professional edition with SP2

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3974543#3974543

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3974543
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user