Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-14-2007, 04:12 PM
Senior Member
 
Join Date: Jun 2007
Posts: 164
Heather is on a distinguished road
SQLServer 2000 EXCEPTION
I have a method to close the connection in SQLServer2000 with java, but it returns to me an exception.
The problem is when I close the connection
here is the code:

Code:
private Connection cn; private Statement st; private ResultSet rs; ..... ... protected int closeT(){ v=1; try { if(rs!=null)rs.close(); cn.close();st.close();} catch (Exception e){ System.out.println(" 'Database' method: 'CloseT' message: " + e.getMessage()); v=0; } return v; }
and this is the exception
'DataBase' method: 'CloseT' message: [Microsoft][ODBC SQL Server Driver]Not valid State of transaction
thanks
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-29-2007, 05:05 PM
bbq bbq is offline
Senior Member
 
Join Date: Jun 2007
Posts: 134
bbq is on a distinguished road
Close first the statement before the connection
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 06-29-2007, 05:09 PM
Senior Member
 
Join Date: Jun 2007
Posts: 164
Heather is on a distinguished road
I did that but it didn't work
any idea?
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 06-29-2007, 05:10 PM
Senior Member
 
Join Date: Jun 2007
Posts: 130
Jack is on a distinguished road
try this:
rs.close()
st.close()
cn.close()
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Where does the exception go? aytidaalkuhs New To Java 3 04-07-2008 04:24 PM
Trouble with factory method - unhandled exception type Exception desmond5 New To Java 1 03-08-2008 08:41 PM
Help, conect a JSP, SQL SERVER 2000 Marcus JavaServer Pages (JSP) and JSTL 1 07-06-2007 05:04 PM
Tomcat with SQLSERVER 2005 bbq Database 1 07-05-2007 06:40 AM
Error with Sql 2000:java.net.NoRouteToHostException: No route to host: connect bbq Database 0 06-27-2007 09:48 PM


All times are GMT +3. The time now is 01:58 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org