473,837 Members | 1,601 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQL Server Stored Proc Issue with Java

5 New Member
I've been reviewing some of the threads here and applying some of the advice and still getting the same error.

Expand|Select|Wrap|Line Numbers
  1. 15:50:26,935 INFO [STDOUT] java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Could not find stored procedure 'getName'.

I'm basically taking a variable coming to my servlet through a JSP page and using it as my search criteria. I know the stored proc will execute through query analyzer, I can execute a regular prepared statement through my servlet, so i know I'm connecting okay, but I'm still baffled. I have included my servlet and SQL Server procedure:


package com.caregain.we b;

import java.io.IOExcep tion;
import java.sql.Callab leStatement;
import java.sql.Connec tion;
import java.sql.Driver Manager;
import java.sql.Result Set;
import java.sql.SQLExc eption;
import javax.servlet.S ervletException ;
import javax.servlet.h ttp.HttpServlet ;
import javax.servlet.h ttp.HttpServlet Request;
import javax.servlet.h ttp.HttpServlet Response;

public class VoidMemberServl et extends HttpServlet {

private static final long serialVersionUI D = 1L;

Connection conn = null;
public VoidMemberServl et() {


public void destroy() {
super.destroy() ;

public void doGet(HttpServl etRequest request, HttpServletResp onse response)
throws ServletExceptio n, IOException {

String state = (String)request .getSession().g etAttribute("st ate");
if(state != "" &&state!=nul l)
callProcedure(s tate);

public void doPost(HttpServ letRequest request, HttpServletResp onse response)
throws ServletExceptio n, IOException {

private void callProcedure(S tring state)
try {
Class.forName(" com.microsoft.j dbc.sqlserver.S QLServerDriver" ).newInstance() ;
conn = DriverManager.g etConnection(
"jdbc:microsoft :sqlserver://Server1:1433;da tabase=test;use r=sa;password=p assword");

//Connection conn = DriverManager.g etConnection(
// "jdbc:microsoft :sqlserver://Server1:1433;da tabase=Server1. test;user=sa;pa ssword=password ");
//PreparedStateme nt statement = conn.prepareSta tement("select * from Server1.test.db o.allUsersinSys tem");
//ResultSet set = statement.execu teQuery();

CallableStateme nt cstmt = conn.prepareCal l("{Call getName(?)}");
cstmt.setString (1,state);

cstmt.execute() ;
ResultSet set = cstmt.getResult Set();

while(set.next( ))
System.out.prin tln(set.getStri ng("uname"));


} catch (ClassNotFoundE xception e) {

e.printStackTra ce();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTra ce();
} catch (InstantiationE xception e) {
// TODO Auto-generated catch block
e.printStackTra ce();
} catch (IllegalAccessE xception e) {
// TODO Auto-generated catch block
e.printStackTra ce();


public void init() throws ServletExceptio n {



There are appropriate execute permissions on all the users and the sproc looks something like:

Expand|Select|Wrap|Line Numbers
  1. CREATE PROCEDURE getName (@State varchar(2)) as Select uname FROM allUsersinSystem WHERE state=@State GO

I dont know how I can execute a prepared statement on a table in the same database, but I can't execute the sproc.

Any suggestions would be great,


Apr 27 '07 #1
1 4190
5 New Member
Well it turns out I needed to call the procedure with the fully qualified 4 part name. I wish the error was a little more descriptive, I thought it was a permissions issue, yet stumbled on the answer by accident.
Apr 30 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Greg D. Moore \(Strider\) | last post by:
Ok, I thought this one would be easy. I have a stored proc: master.dbo.restore_database_foo This is on database server B. Database server A backs up database foo on a daily basis as a scheduled task. What I wanted to do was, at the end of the scheduled task is then call the
by: Jeager | last post by:
Why is it, Microsoft manage to write operating systems and office applications with every bell and whistle facility known to man. Yet, even after years and years of development they still cannot produce a decent version of MS SQL Server, one without a plethora of flaws and limitations? Personally I'd sack the MS SQL Server Chief Architect, start addressing some fundementals and do what MS do best - copy the best functionality of their...
by: jrefactors | last post by:
I want to know the differences between SQL Server 2000 stored procedures and oracle stored procedures? Do they have different syntax? The concept should be the same that the stored procedures execute in the database server with better performance? Please advise good references for Oracle stored procedures also. thanks!!
by: Kent Lewandowski | last post by:
hi all, Recently I wrote some stored procedures using java jdbc code (admittedly my first stab) and then tried to implement the same within java packages (for code reuse). I encountered problems doing this. I wanted to implemented a generic "Helper" class like this: /** * Helper
by: shalini | last post by:
All, we are trying to create and execute our stored procs on db2 ver 8.1 fp5. This is a new database that we setup and are having some trouble. When I try and run the stored proc from the db2 command line, I get the following error: SQL0440N No authorized routine named "XXX" of type "PROCEDURE" having compatible arguments was found. SQLSTATE=42884 When the application (java) tries to execute the sp. we see the following error:
by: mike | last post by:
If I try and do a "SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1" after I have run a stored procedure in DB2 version 7.2, I get the last generated Key before the CallableStatement was executed in the transaction and not the key generated in my stored procedure. Is there a way to set the IDENTITY_VAL_LOCAL or have the stored procedure generated key show up in my IDENTITY_VAL_LOCAL value? Thanks Mike
by: balaji krishna | last post by:
Hi, I need to handle the return set from COBOL stored procedure from my invoking Java program. I do not know, how many rows the stored proc SQL fetches.I have declared the cursor in that proc, but i don't know how to return the rows the cursor has opened and I don't know how to handle the return set from the proc in my java code. My main problem with that proc is that whether I can retun the result set from the proc without closing the cursor...
by: jynxxxed | last post by:
I've been reviewing some of the threads here and applying some of the advice and still getting the same error. 15:50:26,935 INFO java.sql.SQLException: Could not find stored procedure 'getName'. I'm basically taking a variable coming to my servlet through a JSP page and using it as my search criteria. I know the stored proc will execute through query analyzer, I can execute a regular prepared statement through my servlet, so i know I'm...
by: ravindrag | last post by:
Hi, I am getting error SQL1131N during sqlj.install_jar(...). There is no useful message in the diag.log (even with diag level 4). I am giving the diag.log entries at the end of this posting (would have been ideal if there was an option to attach the file). command: db2 call sqlj.install_jar('file:/home/xyz/abc.jar','def.abc') response: SQL1131N DARI (Stored Procedure) process has been terminated abnormally. SQLSTATE=38503
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.