Solved

Changing MS SQL password using JDBC and stored procedure

Posted on 2004-04-15
4
592 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Which is the latest version of Apache Tomcatl 3 49
oracle 11g 23 45
even odd program using while loop 3 19
expectj telnet failing 5 17
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…

943 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

1 Experts available now in Live!

Get 1:1 Help Now