DB connection from Web Logic

Discussions

EJB design: DB connection from Web Logic

  1. DB connection from Web Logic (3 messages)

    How do i connect to Oracle from Web Logic.I guess that define some onfo in WebLOgic.Properties file under Connection Pooling section.can anyone describe the sequence of connection string values?

    Thanks,
    Mubarak.

    Threaded Messages (3)

  2. DB connection from Web Logic[ Go to top ]

    Hi,
      The following could be the values to be changed in WEBLOGIC JDBC CONNECTION POOL MANAGEMENT of the weblogic.properties file.
    Replace the IpAddress:PortNo with appropriate values.

    -Happy Computing, Vamsi Kalyan Poondla
     
    weblogic.jdbc.connectionPool.oraclePool=\
    url=jdbc:oracle:thin:@IPAddress:portNo:databaseName,\
    driver=oracle.jdbc.driver.OracleDriver,\
    loginDelaySecs=1,\
    initialCapacity=2,\
    maxCapacity=10,\
    capacityIncrement=1,\
    allowShrinking=true,\
    shrinkPeriodMins=15,\
    refreshMinutes=10,\
    testTable=dual,\
    props=user=scott;password=tiger;server=oraserver
  3. DB connection from Web Logic[ Go to top ]

    Can i refer this connection pool name to BMP transactions.Is so, how to connect to particular data source?

    Thanks,
    Mubarak.
  4. DB connection from Web Logic[ Go to top ]

    Add this to the property file
    "weblogic.jdbc.TXDataSource.myJtsDataSource=myConnectionPool"
    for a transactional source or
    "weblogic.jdbc.DataSource.myNonJtsDataSource=myConnectionPool"
    for a simple source. Then you can access this source as in the following code

    import java.sql.*;
    import java.util.*;
    import javax.naming.*;

    Context ctx = null;
    Hashtable ht = new Hashtable();
    ht.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    ht.put(Context.PROVIDER_URL, "t3://hostname:port");

    try { ctx = new InitialContext(ht);
     javax.sql.DataSource ds = (javax.sql.DataSource)
    ctx.lookup ("myJtsDataSource");
     java.sql.Connection conn = ds.getConnection();

    // You can now use the conn object to create
    // Statements and retrieve result sets:

    Statement stmt = conn.createStatement();
    stmt.execute("select * from someTable");
    ResultSet rs = stmt.getResultSet();


    // Close the statement and connection objects when you are finished:


    stmt.close();
    conn.close();
    }
    catch (NamingException e)
     { // a failure occurred }
     finally {
        try {ctx.close();
    }
     catch (Exception e) {
          // a failure occurred
     }
    }