开发者

Can I change the 'appName' on an already open JTDS connection?

I'm looking for a way to pass web-application transaction information on to the underlying database process. In my Ja开发者_StackOverflow社区va code I might have a transactional method ReservationService#search(), which runs one or several SQLs. On the DBMS I just see a SPID along with some locks. I'm looking for a way to add a tag "ReservationService#search" to the database process.

jTDS / Sybase ASE have an appName which can be passed in as a connection property. As we're using a connection pool, existing connections are re-used, but to my knowledge the appName is only read on establishing a new connection.

How can I re-set the appName on an already existing connection (without closing/opening)? Or, if that simply is impossible, are there any other ideas to get transactional context information from Java to the DBMS?

  • Tomcat Webapplication (Java 6)
  • C3P0 Connection Pool (only supports JDBC 3)
  • jTDS connecting to Sybase ASE 15

Thanks Simon


Unfortunately not, it seems that you can only specify that in the URL parameters when you open up the connection but can't be altered afterwords.

You can aways pass in a SessionID of some kind from your Java/Tomecat to all your Sybase queries. For me, this was easy as I use stored procedures for all communications between my Java application and the SQL server. I based my SessionID in Java on the J2EE session.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜