Re: Stored Procedure Error ,No ResultSet was produced

From: Alin Sinpalean (alin_at_earthling.net)
Date: 04/21/04


Date: 21 Apr 2004 00:35:03 -0700

vikash verma <reachvikash@yahoo.com> wrote in message news:<#M$EhdhJEHA.3380@TK2MSFTNGP09.phx.gbl>...
> Hi All
> I have written code in Java ie CLASS file.But my DBase is SQL.
> I call a Stored Procedure from my Java Class File.But i get this
> exception
>
> java.sql.SQLException: No ResultSet was produced
> at
> sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeQuery(JdbcOdbcPrepared
> Statement.java:97)
> at
> AutomaticTicketCursor.CursorATG(AutomaticTicketCursor.java:254)
> at AutomaticTicketCursor.main(AutomaticTicketCursor.java:270)
> Main Fn()

The exception is as clear as possible. Your stored procedure doesn't
produce any ResultSet (i.e. if you execute it in Query Analyzer you'll
see that it only produces update counts because there is no SELECT
statement).

executeQuery() is only intended to be used with queries that generate
ResultSets. For queries that generate update counts and for DDL
statements use executeUpdate(). If you don't know what you'll be
executing use execute(). Read the JDBC API documentation for more
information.

And BTW, don't use the JDBC-ODBC bridge in production environments.

Alin.



Relevant Pages

  • Re: Stored Procedure Resultsets?
    ... > It seems like I have to close the cursor before I execute another call. ... > it fair to say that this is returning a resultset? ... > Is there any way for the stored procedure to not return a resultset (if it ...
    (microsoft.public.sqlserver.programming)
  • Re: Stored Procedure Resultsets?
    ... The function you are calling is expecting a result. ... And can quickly execute> another call. ... > Is there any way for the stored procedure to not return a resultset or speed up the efficiency of the stored procedure call? ...
    (microsoft.public.sqlserver.programming)
  • RE: SQL stored procedure executing twice
    ... I wasn't aware that DLookupwould execute the "domain" more than once. ... caused the stored procedure to execute twice. ... Dim stDocName As String ... My pass-thru query properties ...
    (microsoft.public.access.modulesdaovba)
  • Re: recordset not opening even though query analyzer returns resul
    ... I'm convinced that VB can execute this complex SP. ... > only way i could get an earlier version of it to return in a recordset. ... > table into a cursor and add up th evalues of the ccjs based on values in ... >> execute a query the SQL engine returns a resultset. ...
    (microsoft.public.vb.database.ado)
  • Re: SQLserver and the WHERE x IN y
    ... to a stored procedure - that would only work if you introduced subtyping into ... the temp table from the calling procedure (the temp table is still in scope, ... INSERT INTO #MyTempTable EXECUTE YourPopulateProc 123 ... INSERT INTO @MyTableVar VALUES ...
    (microsoft.public.sqlserver.programming)