Skip to content

Instantly share code, notes, and snippets.

@kparms
Created March 26, 2014 18:16
Show Gist options
  • Save kparms/9789770 to your computer and use it in GitHub Desktop.
Save kparms/9789770 to your computer and use it in GitHub Desktop.
Getting JTDS to work with Stored Proc
The main challenge I was running into was SSO:
http://stackoverflow.com/questions/6356612/jtds-driver-not-working-for-sql-sever-2008r2-and-denali-native-sspi-library-not
"Try by placing the ntlmauth.dll file in the bin folder of your Java Runtime Environment (e.g. C:\Program Files\Java\jre7\bin).
I ran into the same issue using SQL Server Express 2008 R2 and this MSDN SQL Server Forum Article recommended this resolution, which worked for me."
I downloaded JTDS-dist and copied the ntlmauth.dll into the jre/bin folder.
The second challenge was the stored procedure did not return a result set, only a message, we got around that with the following:
CallableStatement cstmt = conn.prepareCall("{call StoredProc @documentid=?,@tagdesc=?,@userid=?}");
cstmt.setString(1, "string");
cstmt.setString(2, "string");
cstmt.setString(3, "string");
cstmt.executeUpdate();
SQLWarning youveBeenWarned = cstmt.getWarnings();
System.out.println(youveBeenWarned.getMessage());
http://stackoverflow.com/questions/11463777/get-message-response-from-postgresql-using-jdbc
http://stackoverflow.com/questions/3572626/calling-stored-procedure-from-java-jpa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment