Create connection pools in JDBC

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jith87
    New Member
    • Jul 2007
    • 58

    #1

    Create connection pools in JDBC

    Can u tell me how to create connection pools in JDBC ????
    Ths type of creating is said to have reduced the processing time spent during connecting and disconnecting to the databases.

    Pls help me........

    Thanx n regards........ ....
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by jith87
    Can u tell me how to create connection pools in JDBC ????
    Ths type of creating is said to have reduced the processing time spent during connecting and disconnecting to the databases.

    Pls help me........

    Thanx n regards........ ....
    Go to the Apache commons project; they have nice connection pool implementations .
    It's the DBCP component.

    kind regards,

    Jos

    Comment

    • henrymania
      New Member
      • Sep 2007
      • 14

      #3
      import javax.naming.Co ntext;
      import javax.naming.In itialContext;
      import javax.sql.DataS ource;


      Context ctx = new InitialContext( );
      DataSource ds = (DataSource)ctx .lookup("java:c omp/env/jdbc/HRMS");
      con = ds.getConnectio n();

      Comment

      • henrymania
        New Member
        • Sep 2007
        • 14

        #4
        type ur database name in the lookup

        Comment

        Working...