Sunday, March 11, 2012
Connection is busy with results for another hstmt
server 6.5.
I upgraded DB to SQL Server 2000 and now the application
give me "Connection is busy with results for another
hstmt " ODBC error after I do couple of queries or updates
through the application.
Is it anything to do with ODBC drivers or I have to change
setup of SQL Server?
Thank you
Athar
SQL Server only supports a single active statement per connection. Are you
using the MS JDBC driver to access SQL Server?
If you aren't actually trying to use multiple statements per connection,
then you might be able to workaround the error by making sure the statement
is closed before using another one. I'm not familiar with the JDBC
interface, but in ODBC, you'd call SQLMoreResults() until it returned
SQL_NO_DATA to make sure you've processed all of the results on the wire.
In ADO.NET you will get the same error if you haven't called Close() or
Dispose() on the SqlDataReader before trying to Execute another SqlCommand
on the same SqlConnection.
If you are trying to use multiple statements per connection (at the same
time), then you need to use multiple connections instead.
SQL Server 2005 has a new feature called MARS (Multiple Active Result Sets)
which will allow multiple statements per connection.
Brannon
"Athar" <aikram@.celestica.com> wrote in message
news:185a01c47bdf$ee142e80$a601280a@.phx.gbl...
> I have my java based application that works fine with SQL
> server 6.5.
> I upgraded DB to SQL Server 2000 and now the application
> give me "Connection is busy with results for another
> hstmt " ODBC error after I do couple of queries or updates
> through the application.
> Is it anything to do with ODBC drivers or I have to change
> setup of SQL Server?
> Thank you
> Athar
Connection is busy with results for another hstmt
server 6.5.
I upgraded DB to SQL Server 2000 and now the application
give me "Connection is busy with results for another
hstmt " ODBC error after I do couple of queries or updates
through the application.
Is it anything to do with ODBC drivers or I have to change
setup of SQL Server?
Thank you
AtharSQL Server only supports a single active statement per connection. Are you
using the MS JDBC driver to access SQL Server?
If you aren't actually trying to use multiple statements per connection,
then you might be able to workaround the error by making sure the statement
is closed before using another one. I'm not familiar with the JDBC
interface, but in ODBC, you'd call SQLMoreResults() until it returned
SQL_NO_DATA to make sure you've processed all of the results on the wire.
In ADO.NET you will get the same error if you haven't called Close() or
Dispose() on the SqlDataReader before trying to Execute another SqlCommand
on the same SqlConnection.
If you are trying to use multiple statements per connection (at the same
time), then you need to use multiple connections instead.
SQL Server 2005 has a new feature called MARS (Multiple Active Result Sets)
which will allow multiple statements per connection.
Brannon
"Athar" <aikram@.celestica.com> wrote in message
news:185a01c47bdf$ee142e80$a601280a@.phx.gbl...
> I have my Java based application that works fine with SQL
> server 6.5.
> I upgraded DB to SQL Server 2000 and now the application
> give me "Connection is busy with results for another
> hstmt " ODBC error after I do couple of queries or updates
> through the application.
> Is it anything to do with ODBC drivers or I have to change
> setup of SQL Server?
> Thank you
> Athar
Friday, February 24, 2012
Connection closes often
Hi Team,
I get the below error very often.
java.sql.SQLException: I/O Error: Connection reset Caused by: java.net.SocketException: Connection reset
Followed by a number of "java.sql.SQLException: Invalid state, the Connection object is closed.".
Some time Invalid state, the Statement object is closed."
I have checked out the network problem and time out of queries. And both does not seems to be an issue for me. Because my application send queries continuously (Checked it with mssql profiler all queries executed in minimum interval) and MSSQL runs in the local machine. Meantime i do not see any wrong packet exception.
Is there any other thing i could check out. Any kind of Help is much appreciated.
Thanks for your help.
Hi,
Could you post a full stack trace of the exception(s)?
Thanks,
--David Olix
JDBC Development
|||Hi David,Thanks for your reply.
Please find the trace below.
16:06:46:454 PM Caused by: java.sql.SQLException: Invalid state, the Connection object is closed.
16:06:46:454 PM at net.sourceforge.jtds.jdbc.ConnectionJDBC2.checkOpen(ConnectionJDBC2.java:1213)
16:06:46:454 PM at net.sourceforge.jtds.jdbc.ConnectionJDBC2.createStatement(ConnectionJDBC2.java:1735)
16:06:46:454 PM at com.adventnet.persistence.standalone.LogicalConnection.createStatement(LogicalConnection.java:72)
16:06:46:454 PM at com.adventnet.db.api.RelationalAPI.createStatement(RelationalAPI.java:952)
16:06:46:454 PM at com.adventnet.db.api.RelationalAPI.createStatement(RelationalAPI.java:947)
16:06:46:454 PM at com.adventnet.db.api.RelationalAPI.executeQuery(RelationalAPI.java:750)
16:06:46:454 PM at com.adventnet.persistence.internal.GetUtil.get(GetUtil.java:89)
Thanks,
Navaneeth
|||
I had assumed that you were using the new Microsoft SQL Server 2005 JDBC driver... My apologies. I probably won't be much help to you then.
You may be able to figure out why the connection is being closed by running the SQL Server Profiler to gather a trace while you run your app. You might also want to submit your question to the jTDS or adventnet folks.
Or if you can reproduce your problem with Microsoft's JDBC driver, I might be able to provide some assistance. :-)
--David Olix
JDBC Development
Connection closes often
Hi Team,
I get the below error very often.
java.sql.SQLException: I/O Error: Connection reset Caused by: java.net.SocketException: Connection reset
Followed by a number of "java.sql.SQLException: Invalid state, the Connection object is closed.".
Some time Invalid state, the Statement object is closed."
I have checked out the network problem and time out of queries. And both does not seems to be an issue for me. Because my application send queries continuously (Checked it with mssql profiler all queries executed in minimum interval) and MSSQL runs in the local machine. Meantime i do not see any wrong packet exception.
Is there any other thing i could check out. Any kind of Help is much appreciated.
Thanks for your help.
Hi,
Could you post a full stack trace of the exception(s)?
Thanks,
--David Olix
JDBC Development
|||Hi David,Thanks for your reply.
Please find the trace below.
16:06:46:454 PM Caused by: java.sql.SQLException: Invalid state, the Connection object is closed.
16:06:46:454 PM at net.sourceforge.jtds.jdbc.ConnectionJDBC2.checkOpen(ConnectionJDBC2.java:1213)
16:06:46:454 PM at net.sourceforge.jtds.jdbc.ConnectionJDBC2.createStatement(ConnectionJDBC2.java:1735)
16:06:46:454 PM at com.adventnet.persistence.standalone.LogicalConnection.createStatement(LogicalConnection.java:72)
16:06:46:454 PM at com.adventnet.db.api.RelationalAPI.createStatement(RelationalAPI.java:952)
16:06:46:454 PM at com.adventnet.db.api.RelationalAPI.createStatement(RelationalAPI.java:947)
16:06:46:454 PM at com.adventnet.db.api.RelationalAPI.executeQuery(RelationalAPI.java:750)
16:06:46:454 PM at com.adventnet.persistence.internal.GetUtil.get(GetUtil.java:89)
Thanks,
Navaneeth
|||
I had assumed that you were using the new Microsoft SQL Server 2005 JDBC driver... My apologies. I probably won't be much help to you then.
You may be able to figure out why the connection is being closed by running the SQL Server Profiler to gather a trace while you run your app. You might also want to submit your question to the jTDS or adventnet folks.
Or if you can reproduce your problem with Microsoft's JDBC driver, I might be able to provide some assistance. :-)
--David Olix
JDBC Development
|||Hi ,
i also facing the same problem .i am using the latest jdbc driver from microsoft .
Friday, February 10, 2012
Connecting to SQL Server 7.0
We are writing a Java stand-alone program and need to connect to a SQL
server 7.0 database.
I can't find any drivers to connect to the database. There are very few
which are in the market with interoperability with MS SQL Server7.0. The res
t
are all pointing to MS SQL 2000 or 2005.
Can you please point me to a driver to access SQL Server 7.0 through Java?
If possible a freeware version.You can find a list of vendors who have JDBC drivers at:
http://www.sqlsummit.com/JDBCVend_I.htm
You may be interested in jTDS as well:
http://jtds.sourceforge.net/
-Sue
On Thu, 10 Aug 2006 13:34:01 -0700, Srini
<Srini@.discussions.microsoft.com> wrote:
>Hi,
>We are writing a Java stand-alone program and need to connect to a SQL
>server 7.0 database.
>I can't find any drivers to connect to the database. There are very few
>which are in the market with interoperability with MS SQL Server7.0. The re
st
>are all pointing to MS SQL 2000 or 2005.
>Can you please point me to a driver to access SQL Server 7.0 through Java?
>If possible a freeware version.
Connecting to SQL Server 2k using Thin drivers
I am new to java. I need to write an applet which takes input from user and
updates the database. I wrote a trusted applet but i was unable to access
network resources. Then i wrote thread inside an apllet which is working fine.
When I use JDBC-ODBC driver, its taking DSN from client machine and not from
server. Can i specify Server DSN?
When I use Thin Drivers, I am getting ClassNotFoundException in the
following line
Driver d =
(Driver)Class.forName("com.microsoft.jdbc.sqlserve r.SQLServerDriver").newInstance();
Here is my code, please let me know if anything is wrong
try {
Driver d =
(Driver)Class.forName("com.microsoft.jdbc.sqlserve r.SQLServerDriver").newInstance();
con =
DriverManager.getConnection("jdbc:microsoft:sqlser ver://wks01:1433";User=test;Password=pass");
}
catch(ClassNotFoundException e) { e.printStackTrace();}
catch(Exception e){ e.printStackTrace();}
finally {
try {
Statement stmt = con.createStatement();
stmt.executeUpdate("INSERT INTO lms " + "VALUES ('" + NewApplet.this.lmsVar
+ "')");
if(con != null)
con.close();
}
catch(Exception e) { }
}
Also, If i specify Database Server name as Server name will it resolve from
client
| Thread-Topic: Connecting to SQL Server 2k using Thin drivers
| thread-index: AcS2s/k6uARnoX50RGqx7t2nvEPbgw==
| X-WBNR-Posting-Host: 203.197.255.91
| From: "=?Utf-8?B?VWp3YWwgQyBSZWRkeQ==?=" <Ujwal C
Reddy@.discussions.microsoft.com>
| Subject: Connecting to SQL Server 2k using Thin drivers
| Date: Wed, 20 Oct 2004 07:49:17 -0700
| Lines: 41
| Message-ID: <F3C3AA2A-D44F-413B-9439-E4C1DACD1297@.microsoft.com>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.sqlserver.jdbcdriver
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
| Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: cpmsftngxa10.phx.gbl microsoft.public.sqlserver.jdbcdriver:6408
| X-Tomcat-NG: microsoft.public.sqlserver.jdbcdriver
|
| Hi all,
|
| I am new to java. I need to write an applet which takes input from user
and
| updates the database. I wrote a trusted applet but i was unable to access
| network resources. Then i wrote thread inside an apllet which is working
fine.
|
| When I use JDBC-ODBC driver, its taking DSN from client machine and not
from
| server. Can i specify Server DSN?
|
| When I use Thin Drivers, I am getting ClassNotFoundException in the
| following line
|
| Driver d =
|
(Driver)Class.forName("com.microsoft.jdbc.sqlserve r.SQLServerDriver").newIns
tance();
|
| Here is my code, please let me know if anything is wrong
|
| try {
| Driver d =
|
(Driver)Class.forName("com.microsoft.jdbc.sqlserve r.SQLServerDriver").newIns
tance();
| con =
|
DriverManager.getConnection("jdbc:microsoft:sqlser ver://wks01:1433";User=tes
t;Password=pass");
| }
| catch(ClassNotFoundException e) { e.printStackTrace();}
| catch(Exception e){ e.printStackTrace();}
| finally {
| try {
| Statement stmt = con.createStatement();
| stmt.executeUpdate("INSERT INTO lms " + "VALUES ('" +
NewApplet.this.lmsVar
| + "')");
| if(con != null)
| con.close();
| }
| catch(Exception e) { }
| }
|
|
| Also, If i specify Database Server name as Server name will it resolve
from
| client
|
|
|
Hello,
Just to make sure we're on the same page, I'm assuming a "thin" JDBC driver
to mean a Type 4 driver. The Microsoft JDBC driver is one such driver.
For the ClassNotFoundException, you must ensure that the JDBC driver .jar
files are listed appropriately in your CLASSPATH environment variable or
properly specified in the "-cp" command line parameter of java.exe. The
server name used in the URL to make the connection will either specify the
database server name and instance port number OR the database server name
and SQL Server instance name:
jdbc:microsoft:sqlserver://dbserver\\instance1;User=test;Password=pass;
jdbc:microsoft:sqlserver://dbserver:1456;User=test;Password=pass;
If the SQL Server instance is a default instance, then you can simply use
port 1433 (unless you have changed this default value explicitly) as you
have indicated in your sample above.
Hope that helps!
Carb Simien, MCSE MCDBA MCAD
Microsoft Developer Support - Web Data
Please reply only to the newsgroups.
This posting is provided "AS IS" with no warranties, and confers no rights.
Are you secure? For information about the Strategic Technology Protection
Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security.