Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6231099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:52:18+00:00 2026-05-24T09:52:18+00:00

I use callable interface of Java and try to read the output variable value

  • 0

I use callable interface of Java and try to read the output variable value of a stored procedure written in SQL server.

Stored procedure:

CREATE PROCEDURE [Get_Project_Name_Test] 
    @project_id int,
    @project_name varchar(150) OUTPUT
AS
BEGIN
    SET NOCOUNT ON;
    SET @project_name = (SELECT Name from Project where Project_Id = @project_id)
END
GO

Here @project_id is input variable and @project_name is output variable. I want to read this value of the output variable from Java application. When I run the code I get a sql exception.

It says:

The formal parameter “@project_id” was not declared as an OUTPUT
parameter, but the actual parameter passed in requested output.

Actually, this is not an output parameter. @project_id is the input parameter used to retrieve the result.

Java code which used to call this stored procedure

CallableStatement cstmt = con.prepareCall("{call Get_Project_Name_Test(?)}");
cstmt.setInt(1, 148);
cstmt.registerOutParameter(1, java.sql.Types.VARCHAR);
cstmt.executeQuery();
String x = cstmt.getString(1);
System.out.println(x);

How can I figure out the cause of the error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T09:52:19+00:00Added an answer on May 24, 2026 at 9:52 am

    Should

    cstmt.registerOutParameter(1, java.sql.Types.VARCHAR);
    

    be

     cstmt.registerOutParameter(2, java.sql.Types.VARCHAR);
    

    ?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a C dynamic library that's callable from Java. I've compiled
I use System.Web.Services.WebMethodAttribute to make a public static method of an ASP.NET page callable
I have a COM-Callable Wrapper on a .NET assembly. Some of the methods use
I try to find out how to use complex numbers in QtScripts such that
I'm using the [System.Web.Script.Services.ScriptService] tag to use web services callable from client side javascript.
Since use ExecutorService can submit a Callable task and return a Future , why
Until today, I have been able to use bzr pull server:path/to/trunk , but today
I'm working on creating a COM callable wrapper for the System.Net.NetworkInformation.Ping class for use
I have a Django model with multiple ImageFields and use a callable to determine
Is it possible to use multi-threading in a .NET COM callable wrapper DLL assembly?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.