Solved

Changing MS SQL password using JDBC and stored procedure

Posted on 2004-04-15
4
591 Views
Last Modified: 2012-05-04
Hi, I'm trynig to write a method that changes a user's password in MS SQL Server. I understand that the stored procedure to call is sp_password. The following code returns a JDBC error:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Invalid parameter binding(s).

Any help would be appreciated.

CallableStatement cs = con.prepareCall("{ call sp_password(?,?,?) }");
cs.setString(0,oldPassword);
cs.setString(1,newPassword);
cs.setString(2,userName);
cs.execute();
0
Comment
Question by:matthew_york
  • 2
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
mmuruganandam earned 250 total points
ID: 10831584
setString should start from 1 not from 0.

Regards,
Muruga
0
 
LVL 1

Author Comment

by:matthew_york
ID: 10831641
Thanks, that got over that problem but now i get a message:

java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Line 1: Incorrect syntax near '{

I'm sure this must be something simple. Thanks in advance.
0
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10831652
this could be a problem with your stored procedure.

check your "sp_password" procedure.  compile it for errors.
0
 
LVL 1

Author Comment

by:matthew_york
ID: 10831692
thanks for your help
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

708 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now