Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Stored procedure without input parameters

2 posts in JDBC Connect (product renamed to JConnect) Last posting was on 1997-04-16 18:33:04.0Z
Ellen Carroll Posted on 1997-04-15 23:23:51.0Z
Message-ID: <33540E07.54C8@raba.com>
Date: Tue, 15 Apr 1997 19:23:51 -0400
From: Ellen Carroll <ellen.carroll@raba.com>
Reply-To: ellen.carroll@raba.com
Organization: RABA Technologies
X-Mailer: Mozilla 3.0Gold (Win95; U)
MIME-Version: 1.0
Subject: Stored procedure without input parameters
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.jdbcconnect
Lines: 50
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jdbcconnect:997
Article PK: 252752

I am getting an SQLException when I call the execute() method to execute
a stored procedure that has no input parameters. This is under jdk
1.1.1., jConnect version 2.0. The SQL server error code is 0. The code
sample, stack trace, and Version output follows.


+++++++

Connection c;
.
.
.

try {
String call = new String("{? = call selectFoo() }");
cstmt = c.prepareCall(call);

// register return value as an output parameter
cstmt.registerOutParameter(1, java.sql.Types.INTEGER);
cstmt.execute();

boolean more=true;
while (more) {

ResultSet rs = cstmt.getResultSet();
// do something meaningful with the results
.
.
.
more = cstmt.getMoreResults();
}

// check return value
Integer returnValue = (Integer)cstmt.getObject(1);

} catch (java.sql.SQLException e) {
System.out.println("Error code=> "+e.getErrorCode());
e.printStackTrace();
return (false);
}
.
.
.
++++++++++++

Error code=> 0
java.sql.SQLException: No parameters expected. Has query been sent?: No
Parameters expected. Has
Query been sent?
at com.sybase.jdbc.ErrorMessage.raiseError(ErrorMessage.java)
at com.sybase.jdbc.ErrorMessage.raiseError(ErrorMessage.java)
at com.sybase.jdbc.ParamManager.getStatus(ParamManager.java)
at
com.sybase.jdbc.SybCallableStatement.handleStatus(SybCallableStatement.java)
at com.sybase.jdbc.SybCallableStatement.nextResult(SybStatement.java)
at
com.sybase.jdbc.SybCallableStatement.getMoreResults(SybStatement.java)
at SPTestFoo.execute(SPselectFoo.java:40)

+++++++++++++

% java Version
Using JDBC driver version 2.0

jConnect (TM) for JDBC (TM)/2.0/Production Version/JDK11/Thu Mar 13
14:34:32 1997

+++++++++++++

%java -version
java version "1.1.1"

+++++++++++++

If I change the call string to
String call = new String("{? = call selectFoo(?) }");

and add a call to
cstmt.setInt(2, 0);

all works fine.


Thanks,

Ellen Carroll


David Clegg Posted on 1997-04-16 18:33:04.0Z
Message-ID: <33551B60.2174B315@sybase.com>
Date: Wed, 16 Apr 1997 11:33:04 -0700
From: David Clegg <davec@sybase.com>
X-Mailer: Mozilla 2.01 (X11; I; Linux 1.2.13 i586)
MIME-Version: 1.0
To: ellen.carroll@raba.com
CC: jdbcdev
Subject: Re: Stored procedure without input parameters
References: <33540E07.54C8@raba.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.jdbcconnect
Lines: 73
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jdbcconnect:987
Article PK: 252741

Congratulations, you are our grand prize winner!

You've just reported the first real bug against the jConnect 2.0
product -- I have entered the bug into our tracking system, the
number for your future reference is:

129151

As you've discovered, one workaround is to pass a dummy input
parameter, another would be to ignore the return-status.

If this bug is critical to you, you can open a support case with
our Technical Support team -- please give them the bug # above
if you do.

Thanks, and sorry,

dave

>
> I am getting an SQLException when I call the execute() method to execute
> a stored procedure that has no input parameters. This is under jdk
> 1.1.1., jConnect version 2.0. The SQL server error code is 0. The code
> sample, stack trace, and Version output follows.
>
> +++++++
>
> Connection c;
> .
> .
> .
>
> try {
> String call = new String("{? = call selectFoo() }");
> cstmt = c.prepareCall(call);
>
> // register return value as an output parameter
> cstmt.registerOutParameter(1, java.sql.Types.INTEGER);
> cstmt.execute();
>
> boolean more=true;
> while (more) {
>
> ResultSet rs = cstmt.getResultSet();
> // do something meaningful with the results
> .
> .
> .
> more = cstmt.getMoreResults();
> }
>
> // check return value
> Integer returnValue = (Integer)cstmt.getObject(1);
>
> } catch (java.sql.SQLException e) {
> System.out.println("Error code=> "+e.getErrorCode());
> e.printStackTrace();
> return (false);
> }
> .
> .
> .
> ++++++++++++
>
> Error code=> 0
> java.sql.SQLException: No parameters expected. Has query been sent?: No
> Parameters expected. Has
> Query been sent?
> at com.sybase.jdbc.ErrorMessage.raiseError(ErrorMessage.java)
> at com.sybase.jdbc.ErrorMessage.raiseError(ErrorMessage.java)
> at com.sybase.jdbc.ParamManager.getStatus(ParamManager.java)
> at
> com.sybase.jdbc.SybCallableStatement.handleStatus(SybCallableStatement.java)
> at com.sybase.jdbc.SybCallableStatement.nextResult(SybStatement.java)
> at
> com.sybase.jdbc.SybCallableStatement.getMoreResults(SybStatement.java)
> at SPTestFoo.execute(SPselectFoo.java:40)
>
> +++++++++++++
>
> % java Version
> Using JDBC driver version 2.0
>
> jConnect (TM) for JDBC (TM)/2.0/Production Version/JDK11/Thu Mar 13
> 14:34:32 1997
>
> +++++++++++++
>
> %java -version
> java version "1.1.1"
>
> +++++++++++++
>
> If I change the call string to
> String call = new String("{? = call selectFoo(?) }");
>
> and add a call to
> cstmt.setInt(2, 0);
>
> all works fine.
>
> Thanks,
>
> Ellen Carroll