문제

I am writing some Java code to query a stored procedure in a SQLServer database. My connection string looks like:

jdbc:jtds:sqlserver://address:port;database=dbname

Now when I try to call a stored procedure with the connection:

  String sql = "{call xyz.StoreProcNamedFoo(?,?,?,?)}";

I receive this error:

java.sql.SQLException: Could not find stored procedure 'xyz.StoreProcNamedFoo'.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2886)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2328)
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:638)
at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:614)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:573)
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.execute(JtdsPreparedStatement.java:764)

A DBA suggested he change the default schema to xyz, instead of abc. That worked great, but he had to change it right back, since the default schema has to be abc. My question is, how do I call this stored proc?

도움이 되었습니까?

해결책

I changed drivers from jtds to the official Microsoft release. Works now.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top