?
Solved

Changing MS SQL password using JDBC and stored procedure

Posted on 2004-04-15
4
Medium Priority
?
602 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 750 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses
Course of the Month13 days, 21 hours left to enroll

809 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