Results 1 to 4 of 4
  1. #1
    Heather is offline Senior Member
    Join Date
    Jun 2007
    Posts
    164
    Rep Power
    7

    Default 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:

    Java 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

  2. #2
    bbq
    bbq is offline Senior Member
    Join Date
    Jun 2007
    Posts
    132
    Rep Power
    0

    Default

    Close first the statement before the connection
    ;)

  3. #3
    Heather is offline Senior Member
    Join Date
    Jun 2007
    Posts
    164
    Rep Power
    7

    Default

    I did that but it didn't work
    any idea?

  4. #4
    Jack is offline Senior Member
    Join Date
    Jun 2007
    Posts
    130
    Rep Power
    0

Similar Threads

  1. Where does the exception go?
    By aytidaalkuhs in forum New To Java
    Replies: 3
    Last Post: 04-07-2008, 02:24 PM
  2. Replies: 1
    Last Post: 03-08-2008, 06:41 PM
  3. Help, conect a JSP, SQL SERVER 2000
    By Marcus in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 07-06-2007, 03:04 PM
  4. Tomcat with SQLSERVER 2005
    By bbq in forum JDBC
    Replies: 1
    Last Post: 07-05-2007, 04:40 AM
  5. Replies: 0
    Last Post: 06-27-2007, 07:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •