Re: getting Multiple resultsets in java using stored procedure in MS SQL Server 2000

Tech-Archive recommends: Fix windows errors by optimizing your registry





anil wrote:

I have a stored procedure with multiple (two) queries in MS-SQL 2000
Server,

I'm trying to get the resultset in java
like


cStmt = conn.prepareCall("{ call spXXX (?)}");
cStmt.setString(1, val);


What is the variable defined as in the procedure?
What is the column type that the variable is
used to compare to? I suspect you're trying to rely
on the DBMS doing implicit conversion, which it will
do for fresh SQL, but not parameters.
Joe Weinstein at BEA Systems.

boolean result = cStmt.execute();
System.out.println("result:" + result);

if(result)
{
ResultSet rs1 = cStmt.getResultSet();
System.out.println("rs1" + rs1);
while(rs1.next())
{
<process resultset>
}
rs1.close();
boolean result2 = cStmt.getMoreResults();
System.out.println("result2:" + result2);
if(result2)
{
ResultSet rs2 = cStmt.getResultSet();
System.out.println("rs2" + rs2);
while(rs2.next())
{
<process resultset>

}
rs2.close();
}
}

I'm getting the resultset object in java but there are no records in
the resultset, but if i run the same query seperately in the query
analyser, i get the results.
Am I doing anything wrong?

Any help in this regard would be really great. Thank you.

-Anil


.



Relevant Pages

  • Re: Statement and Resultset
    ... I've a java method like this above: ... public static ResultSet eseguiSelectthrows ... I suspect that the database connection object is the one ...
    (comp.lang.java.programmer)
  • Re: more than a one result set at the same time
    ... or more "ResultSet" to complete my work? ... The java approach would be to select all from date_info_table, ... The date info you would need to display would be sorted, hashed, ... rinsed and dried on the application server before it is ...
    (comp.databases.oracle.misc)
  • Re: using xsl to filter out xml data
    ... > Our back-end servicereturns resultset data in xml format. ... > We use Castor to convert xml to java. ... > Some people say that If use XSL and put business rules into XSL and let ...
    (comp.lang.java.programmer)
  • Re: Db2dclgn Indicator variables
    ... I have a Java JDBC program that reads records from an Oracle ... handleRow(++cnt, resultset, pstmtDB2); ... ps.setInt(++i, lockedUserProfileID); ... int lockedUserProfileID; ...
    (comp.lang.cobol)
  • Re: Upgrading to Java 6- will it run on 5?
    ... the generated classes work on a Java 5 jre? ... That ResultSet now extend's Wrapper ...
    (comp.lang.java.programmer)