aspose file tools
The moose likes JDBC and Relational Databases and the fly likes Stored proc not found... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Stored proc not found..." Watch "Stored proc not found..." New topic

Stored proc not found...

Kingsley Mullers
Ranch Hand

Joined: Jan 14, 2005
Posts: 48
Hi there,

I�ve finally managed to connect to SQL Server but the problem is that the stored procedure is not found whereas it does exists, is there anything that I might have omitted that�s causing this type of error, I�ve specified the full path but no success,
my code looks like this..

import java.sql.*;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
* Microsoft SQL Server JDBC
public class PhoneBookDetails {
// Get connection
// DriverManager.registerDriver(new;
public Connection getConnection(){
Connection connection=null;
String driverName = "";
String username="fido";
String password="odif";
String databasename="RSAPORTAL";
String url="jdbc:microsoft:sqlserver://SERVERNAME:0000;
databasename= data_base_name;username=username;password=password";

}catch(ClassNotFoundException e)

}catch(SQLException e){
System.out.println("Exception" +e);
return connection;

public String getPhoneBookDetails(Connection connection,String Username)
String details="";
CallableStatement callableStatement =connection.prepareCall("{call getHR_PhoneBookEntryByUsername ?}");
ResultSet resultSet = callableStatement.executeQuery();
System.out.println("usernameDetail 1 " + resultSet.getString(2));
System.out.println("usernameDetail 2 " + resultSet.getString(3));
System.out.println("usernameDetail 3 " + resultSet.getString(4));
System.out.println("usernameDetail 4 " + resultSet.getString(5));
System.out.println("usernameDetail 5 " + resultSet.getString(6));
System.out.println("usernameDetail 6 " + resultSet.getString(7));
System.out.println("usernameDetail 7 " + resultSet.getString(8));
System.out.println("usernameDetail 8 " + resultSet.getString(9));
System.out.println("usernameDetail 9 " + resultSet.getString(10));
System.out.println("usernameDetail 10 " + resultSet.getString(11));
System.out.println("usernameDetail 11 " + resultSet.getString(12));
System.out.println("usernameDetail 12 " + resultSet.getString(13));
System.out.println("usernameDetail 13 " + resultSet.getString(14));
System.out.println("usernameDetail 14 " + resultSet.getString(15));

}catch(Exception e){
System.out.println("Exception" +e);
return details;
public void closeConnection(Connection cn){


if (cn != null)
}catch(Exception e){
public static void main (String args[]) throws Exception
PhoneBookDetails test = new PhoneBookDetails();
Connection c=test.getConnection();

System.out.println("Connection is null...");
String x =test.getPhoneBookDetails(c, "Mwelas_m");
System.out.println("Connection is successful...!!!");
Sravan Kumar
Ranch Hand

Joined: Sep 11, 2005
Posts: 121
Try prefixing the strored procedure name with the owner name. for instance, if the owner is 'dbo', call it as dbo.getHR_PhoneBookEntryByUsername

keep smilin :: sravan<br /><a href="" target="_blank" rel="nofollow">I scribble here</a>
Kingsley Mullers
Ranch Hand

Joined: Jan 14, 2005
Posts: 48
thanks for the response, i've tried that, cos the store proc above it has dbo, but this one i'm calling has fido in front of it but still no luck...
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Stored proc not found...
It's not a secret anymore!