Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2002
    Posts
    84

    Unanswered: Help: JDBC Connection

    I had a jsp that connects to a DB2 using jdbc connection.
    It is something like:


    > <%@ page isThreadSafe="true" %>
    > ...
    >
    > Connection conn = null;
    > Statement stmt = null;
    > ResultSet rs = null;
    > ...
    >
    > try
    > {
    > synchronized(this)
    > {
    > conn = DriverManager.getConnection(URL, id, pwd);
    > }
    >
    > stmt = conn.createStatement ();
    > rs = stmt.executeQuery(strSQLStmt);
    >
    > } catch (Exception ee)
    > {}


    When there are many concurrent accesses, sometimes A will see the
    result set of B.

    I believe it is due to incorrect way of handling concurrent accesses
    to database. Anyone advice about how to cope with it? Thanks.

  2. #2
    Join Date
    Aug 2003
    Location
    virgin forest
    Posts
    2
    Code:
    ..........
    [r]Class.forName(driver class); //required[/r] 
    conn = DriverManager.getConnection(URL, id, pwd);
    ................

Posting Permissions

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