[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Is there any way to get the SPID from JDBC?

Posted on 2009-04-22
Medium Priority
Last Modified: 2012-05-06

We are using sql server 2005 to do some db work, the java application is connecting to it via the open source jtds driver.  I'm logging out the procedure calls and params, I'd also like to get the value of @@SPID (connection ID) in there as well.  But google is not turning up anything, and I don't see it anywhere.  We are also using spring's JdbcTemplate and StoredProcedure class if that helps any.

So is this possible to get the server connection ID from jdbc land, and if so how?  If not, why not?

Connection con = dataSource.getConnection();
con.getSPID(); // no such method ??

Open in new window

Question by:RussoMA
  • 2
LVL 92

Expert Comment

ID: 24210105
you need to get value from the result set



Author Comment

ID: 24214985
right i can run a query to get it, I'm really asking if getSpid() or getProcessId() or getConnectionID() is built into the jdbc api somewhere.

it should be!
LVL 92

Accepted Solution

objects earned 1000 total points
ID: 24220247
no its not

LVL 20

Assisted Solution

Venabili earned 1000 total points
ID: 24222913
>>If not, why not?
Because Sun decided not to add it. Feel free to submit a feature request or to mail them and ask why -- but if something is not there, it simply is not there.

PS: no points for me here please; objects already answered this one

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, we’ll look at how to deploy ProxySQL.
Creating a Cordova application which allow user to save to/load from his Dropbox account the application database.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month18 days, 18 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question