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

    Default How to close JDBC Connection

    Please help me with this
    How do you close the JDBC connection back to the Connection pool?
    Can you send me a sample?
    thanks!

  2. #2
    paty is offline Member
    Join Date
    Jul 2007
    Posts
    41
    Rep Power
    0

    Default

    You can use close() method of Connection .
    Java Code:
    connection.close();

  3. #3
    varunthecool is offline Member
    Join Date
    Jul 2007
    Location
    bangalore,india
    Posts
    19
    Rep Power
    0

    Post your code

    Java Code:
    Connection con=null;
    try
    {
                 Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                 con=DriverManager.getConnection("jdbc:odbc:Data1","sa","");
                 // your code follows here...the connection is done
    }
    catch(SQLException e)
    {}
    finally
    {
                  con.close();
    }
    Last edited by JavaBean; 07-15-2007 at 01:19 PM. Reason: Placed inside [code] tag.

Similar Threads

  1. Replies: 0
    Last Post: 04-01-2008, 10:17 AM
  2. JDBC connection
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-10-2007, 07:39 PM
  3. Replies: 0
    Last Post: 09-28-2007, 12:56 PM
  4. SQL Server 2005 Jdbc connection
    By mgt83 in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 07-27-2007, 04:52 AM
  5. JDBC driver connection problem
    By creativehacker in forum JDBC
    Replies: 3
    Last Post: 07-10-2007, 09:58 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
  •