The Artima Developer Community
Sponsored Link

Java Answers Forum
what am i doing wrong

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
john mattucci

Posts: 8
Nickname: mats26
Registered: Apr, 2002

what am i doing wrong Posted: Jun 20, 2002 1:23 PM
Reply to this message Reply
Advertisement
Calling a stored procedure which returns multiple result sets. My problem which I cant seem to figure out; when I call cs.getResultSet() all result sets are returned ie 4. Im using ThinWeb Technologies(tm) Driver Version 1.3 for MS SQL Server. Why is this happening???

CallableStatement cs = myCon.prepareCall("{call initial_info (?)}");
cs.setInt(1, InfoGetter.locationInt);

boolean success = cs.execute();
int i = 0;
while(success)
{
myRs = cs.getResultSet();
information = new Vector();
do
{
if(i == 0 || i == 1)
information.addElement(new Integer(myRs.getInt(1)));
else if(i == 2)
information.addElement(myRs.getString(1));
else if(i == 3)
{
Object o[] = new Object[2];
o[0] = myRs.getString(1);
o[1] = new Integer(myRs.getInt(2));
information.addElement(o);
}
}while(myRs.next());
i++;
myRs.close();
success = cs.getMoreResults();
}
//close connections
myRs.close();
cs.close();

CREATE PROC initial_info(@location int)
AS
--1/
SELECT route From route WHERE location = @location
AND type = 0 ORDER BY [route] ASC;
--2/
SELECT number From bdrdsmnum WHERE location = @location
ORDER BY [number] ASC;
--3/
SELECT name From salereps WHERE location = @location
ORDER BY [name] ASC;
--4/
SELECT description, number From marketsegments;
GO

Topic: jswing & a io rw dat file application Previous Topic   Next Topic Topic: jswing & a io rw dat file application ..... again

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use