Showing posts with label resultset. Show all posts
Showing posts with label resultset. Show all posts

Sunday, March 11, 2012

Can't retrieve second resultset with jdbc sql server 2005 driver

Hi All,

My java application executes one stored procedure that returns two resultsets and then deal with data. The code actually is very simple

Statement stmt = con.createStatement(); con is database connection

ResultSet rs = stmt.getResultSet();

//Do something

rs.close();

rs = stmt.getResultSet();

//Do something

Then I got the error: The result set is closed.

The code worked well with jdbc sql server 2000 driver.

Thanks for your help.

Eric

Hello lxiao,

The syntax for getting the second result set is

if(stmt.getMoreResults())

stmt.getResultSet();

Keep in mind that the getMoreResults() methods takes multiple arguments which controls how visited result sets should persist. Those flags are:

CLOSE_CURRENT_RESULT

CLOSE_ALL_RESULTS

You can find more information about using multiple result sets objects at the following site http://msdn2.microsoft.com/en-us/library/ms378758.aspx

Regards,

Jaaved Mohammed

Can't retrieve second resultset with jdbc sql server 2005 driver

Hi All,

My java application executes one stored procedure that returns two resultsets and then deal with data. The code actually is very simple

Statement stmt = con.createStatement(); con is database connection

ResultSet rs = stmt.getResultSet();

//Do something

rs.close();

rs = stmt.getResultSet();

//Do something

Then I got the error: The result set is closed.

The code worked well with jdbc sql server 2000 driver.

Thanks for your help.

Eric

Hello lxiao,

The syntax for getting the second result set is

if(stmt.getMoreResults())

stmt.getResultSet();

Keep in mind that the getMoreResults() methods takes multiple arguments which controls how visited result sets should persist. Those flags are:

CLOSE_CURRENT_RESULT

CLOSE_ALL_RESULTS

You can find more information about using multiple result sets objects at the following site http://msdn2.microsoft.com/en-us/library/ms378758.aspx

Regards,

Jaaved Mohammed

Sunday, February 12, 2012

Can't get unicode strings using JDBC driver

Hi;

If I call the following to get a Statement, ResultSet.getString() works fine with unicode strings:
Statement stmt = conn.createStatement();

But If I use the following:
Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);

Then all chars > 127 are returned as an ? from ResultSet.getString().

I think this is a bug.

? - thanks - dave

ps - I believe it's the latest Sql Server 200 drivers - they are all dated 4/21/04|||David --

It looks like this was resolved in the microsoft.public.sqlserver.jdbcdriver forum. Let us know if you still have issues.

-shelby

Can't get unicode strings using JDBC driver

Hi;

If I call the following to get a Statement, ResultSet.getString() works fine with unicode strings:
Statement stmt = conn.createStatement();

But If I use the following:
Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);

Then all chars > 127 are returned as an ? from ResultSet.getString().

I think this is a bug.

? - thanks - dave

ps - I believe it's the latest Sql Server 200 drivers - they are all dated 4/21/04|||David --

It looks like this was resolved in the microsoft.public.sqlserver.jdbcdriver forum. Let us know if you still have issues.

-shelby

Can't get unicode strings

Hi;
If I call the following to get a Statement, ResultSet.getString()
works fine with unicode strings:
Statement stmt = conn.createStatement();
But If I use the following:
Statement stmt =
conn.createStatement(ResultSet.TYPE_SCROLL_INSENSI TIVE,
ResultSet.CONCUR_UPDATABLE);
Then all chars > 127 are returned as an ?
I think this is a (BIG BIG BIG) bug.
? - thanks - dave
david@.at-at-at@.windward.dot.dot.net
Windward Reports -- http://www.WindwardReports.com
Page 2 Stage -- http://www.Page2Stage.com
Enemy Nations -- http://www.EnemyNations.com
me -- http://dave.thielen.com
Barbie Science Fair -- http://www.BarbieScienceFair.info
(yes I have lots of links)
What driver are you using? 2000, 2005 beta 1 or 2005 beta 2?
Thanks,
Angel Saenz-Badillos [MS] DataWorks
This posting is provided "AS IS", with no warranties, and confers no
rights.Please do not send email directly to this alias.
This alias is for newsgroup purposes only.
I am now blogging: http://weblogs.asp.net/angelsb/
"David Thielen" <david@.windward.net> wrote in message
news:3rqsk1tti6dmn9dr5ifevdsls612iqu7hs@.4ax.com...
> Hi;
> If I call the following to get a Statement, ResultSet.getString()
> works fine with unicode strings:
> Statement stmt = conn.createStatement();
> But If I use the following:
> Statement stmt =
> conn.createStatement(ResultSet.TYPE_SCROLL_INSENSI TIVE,
> ResultSet.CONCUR_UPDATABLE);
> Then all chars > 127 are returned as an ?
> I think this is a (BIG BIG BIG) bug.
> ? - thanks - dave
> david@.at-at-at@.windward.dot.dot.net
> Windward Reports -- http://www.WindwardReports.com
> Page 2 Stage -- http://www.Page2Stage.com
> Enemy Nations -- http://www.EnemyNations.com
> me -- http://dave.thielen.com
> Barbie Science Fair -- http://www.BarbieScienceFair.info
> (yes I have lots of links)
|||I think the latest SqlServer 2000 ones. They are dated 4-21-04
thanks - dave
On Fri, 14 Oct 2005 15:13:15 -0700, "Angel Saenz-Badillos[MS]"
<angelsa@.online.microsoft.com> wrote:

>What driver are you using? 2000, 2005 beta 1 or 2005 beta 2?
>Thanks,
david@.at-at-at@.windward.dot.dot.net
Windward Reports -- http://www.WindwardReports.com
Page 2 Stage -- http://www.Page2Stage.com
Enemy Nations -- http://www.EnemyNations.com
me -- http://dave.thielen.com
Barbie Science Fair -- http://www.BarbieScienceFair.info
(yes I have lots of links)
|||Dave:
That behavior doesn't reproduce for me -- can you post some code?
-shelby
"David Thielen" <david@.windward.net> wrote in message
news:teh0l19vvmg9gc2fvkes9a24rh9jpr9otv@.4ax.com...
>I think the latest SqlServer 2000 ones. They are dated 4-21-04
> thanks - dave
> On Fri, 14 Oct 2005 15:13:15 -0700, "Angel Saenz-Badillos[MS]"
> <angelsa@.online.microsoft.com> wrote:
>
> david@.at-at-at@.windward.dot.dot.net
> Windward Reports -- http://www.WindwardReports.com
> Page 2 Stage -- http://www.Page2Stage.com
> Enemy Nations -- http://www.EnemyNations.com
> me -- http://dave.thielen.com
> Barbie Science Fair -- http://www.BarbieScienceFair.info
> (yes I have lots of links)
|||On Mon, 17 Oct 2005 18:03:36 -0700, "Shelby Goerlitz [MSFT]"
<shelbyg@.online.microsoft.com> wrote:

>Dave:
>That behavior doesn't reproduce for me -- can you post some code?
Please take a look at http://www.windward.net/jdbc_unicode.zip Two key
notes:
1) use conn.createStatement(ResultSet.TYPE_SCROLL_INSENSI TIVE,
ResultSet.CONCUR_UPDATABLE) - if you just do conn.createStatement() it
works.
2) If you create a database with, for example Chinese as the default
charset, then Chinese can be retrieved - but not Russian. So the
"default" charset seems to be ok - but not other charsets. If your
default charset is English then most anything > 127 is a problem.
thanks - dave

>-shelby
>"David Thielen" <david@.windward.net> wrote in message
>news:teh0l19vvmg9gc2fvkes9a24rh9jpr9otv@.4ax.com.. .
>
david@.at-at-at@.windward.dot.dot.net
Windward Reports -- http://www.WindwardReports.com
Page 2 Stage -- http://www.Page2Stage.com
Enemy Nations -- http://www.EnemyNations.com
me -- http://dave.thielen.com
Barbie Science Fair -- http://www.BarbieScienceFair.info
(yes I have lots of links)
|||Hi;
Any luck finding the bug using the example I created?
thanks - dave
On Tue, 18 Oct 2005 07:58:16 -0600, David Thielen <david@.windward.net>
wrote:

>On Mon, 17 Oct 2005 18:03:36 -0700, "Shelby Goerlitz [MSFT]"
><shelbyg@.online.microsoft.com> wrote:
>
>Please take a look at http://www.windward.net/jdbc_unicode.zip Two key
>notes:
>1) use conn.createStatement(ResultSet.TYPE_SCROLL_INSENSI TIVE,
>ResultSet.CONCUR_UPDATABLE) - if you just do conn.createStatement() it
>works.
>2) If you create a database with, for example Chinese as the default
>charset, then Chinese can be retrieved - but not Russian. So the
>"default" charset seems to be ok - but not other charsets. If your
>default charset is English then most anything > 127 is a problem.
>thanks - dave
>
>
>david@.at-at-at@.windward.dot.dot.net
>Windward Reports -- http://www.WindwardReports.com
>Page 2 Stage -- http://www.Page2Stage.com
>Enemy Nations -- http://www.EnemyNations.com
>me -- http://dave.thielen.com
>Barbie Science Fair -- http://www.BarbieScienceFair.info
>(yes I have lots of links)
david@.at-at-at@.windward.dot.dot.net
Windward Reports -- http://www.WindwardReports.com
Page 2 Stage -- http://www.Page2Stage.com
Enemy Nations -- http://www.EnemyNations.com
me -- http://dave.thielen.com
Barbie Science Fair -- http://www.BarbieScienceFair.info
(yes I have lots of links)
|||Dave:
Sorry for the delay -- the issue has been escalated on this side and the dev
team is looking at it.
-shelby
"David Thielen" <david@.windward.net> wrote in message
news:cq5jl1d9gk6csfr197rc2lbaqfsk4lqgbs@.4ax.com...
> Hi;
> Any luck finding the bug using the example I created?
> thanks - dave
>
> On Tue, 18 Oct 2005 07:58:16 -0600, David Thielen <david@.windward.net>
> wrote:
>
> david@.at-at-at@.windward.dot.dot.net
> Windward Reports -- http://www.WindwardReports.com
> Page 2 Stage -- http://www.Page2Stage.com
> Enemy Nations -- http://www.EnemyNations.com
> me -- http://dave.thielen.com
> Barbie Science Fair -- http://www.BarbieScienceFair.info
> (yes I have lots of links)