Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sybase problem

 
Chinmay Bajikar
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using jconn2 5.5 to connect to Sybase backend.
I have a ConnectionPool in my appln code, with apis like getConnection()
and releaseConnection(), which releases the connection back in the pool.
At my side this works fine, but we have a clint site problem when suddenly
a connection close happens (I dont think this happens tohrough my code as the same code runs fine here).

Is there anything in the Sybase settings that I must look at?
Has anybdy else faced similar issues?

Thanks,
Chinmay
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have used sybase jconn2.jar jdbc drivers and have had no problems. Could their be a serverside setting that is timing out your caches? Either in the app server or sybase? Some app servers can check to see if a connection is ok before giving a client the connection. If it isn't ok then the app server will open a new connection for you. Can you try to set this? Perhaps you are having intermittent network connectivity problems between your app server and the database.
 
Chinmay Bajikar
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Steve,

I have a plain java/jdbc code.
No app server is being used.
Also I have my connection object wrapped in a proxy connectionobject.
So I can moniter all my close() calls.
They are being called by my shutdownhook.
Never in the runtime.

What do you think could be a server setting tht closes the connection implicitly?
Sorry,but this is the 1st time I am working on Sybase.

here is my exception

java.sql.SQLException: JZ0C0: Connection is already closed.
at com.sybase.jdbc2.jdbc.ErrorMessage.raiseError(ErrorMessage.java:498)
at com.sybase.jdbc2.jdbc.SybConnection.checkConnection(SybConnection.jav
a:1619)
at com.sybase.jdbc2.jdbc.SybStatement.checkDead(SybStatement.java:1717)
at com.sybase.jdbc2.jdbc.SybPreparedStatement.setString(SybPreparedState
ment.java:249)
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the proxy object a thin wrapper that makes the jdbc calls? If it is then if you put a JAMon call for each open and close connection you can see if you are closing connections in your code when you shouldn't be.

This approach is used in my demo program at
http://ssouza.kgbinternet.com/fdsapi/JAMonAdmin.jsp?sortCol=2&sortOrder=desc

The database open is represented with this label: com.fdsapi.DataAccess.Client.getConnection()
and close with this one:
com.fdsapi.DataAccess.close()

Notice in my code the number of open connections, matches the number of close connections.

Perhaps your code is calling close somewhere when it shouldn't. Being as you don't mention that you are using pooled connections the connections are being closed as opposed to being returned to the pool.

Here is the wrapper object that I use to make/and monitor my jdbc calls. Notice it also keeps timing stats for the calls.

http://cvs.sourceforge.net/viewcvs.py/fdsapi/fdsapi/Code/com/fdsapi/DataAccessBase.java?rev=1.3&view=auto
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic