Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

calling stored proc just won't work

Bill Ross
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am trying to call a system stored proc from SQL Server 7.0 in order to set the Truncate log on checkpoint to a value set by the user. I am this close to getting it <bill holds his thumb and index finger really close together> but can't seem to get it to run. It keeps throwing an exception.
Here are the details:
This statement works perfect when run directly against the SQL Server database using a query tool (MS Query Analyzer):
sp_dboption 'pubs', 'trunc', 'false'
WHERE 'pubs' is the database name.
This also works:
sp_dboption pubs, trunc, false
ALL PARAMETERS are nvarchar

This is the Java JDBC statement I am trying to run:

CallableStatement cs = con.prepareCall("{call sp_dboption(?, ?, ?)}");
cs.setString(1, theData.getDatabaseName());
cs.setString(2, "trunc");
cs.setString(3, this.isTruncateLog());
This is the error message thrown:
[MERANT][SQLServer JDBC Driver][SQLServer]Usage: sp_dboption [dbname [,optname [,'true' | 'false']]]

Can anyone help me out here. I have been 'playing' with it a good part of the afternoon trying to solve this, and I am about to look like the 'Bad Day' guy kicking his monitor across the room.
Any help would be greatly appreciated.

Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!