from what class comes DataSource?

-----Mensagem original-----
De: Godbey, David [mailto:[EMAIL PROTECTED]]
Enviada em: segunda-feira, 10 de dezembro de 2001 13:51
Para: [EMAIL PROTECTED]
Assunto: Re: JDBC in WEBLOGIC error


This is how I get connections thru the Weblogic connection pool. I'm still
using WL 5.1. In weblogic.properties file, define a Connection pool like
this:

weblogic.jdbc.connectionPool.IpmsDevPool=\
       url=jdbc:weblogic:oracle,\
       driver=weblogic.jdbc.oci.Driver,\
       loginDelaySecs=1,\
       initialCapacity=1,\
       maxCapacity=5,\
       capacityIncrement=1,\
       allowShrinking=true,\
       shrinkPeriodMins=15,\
       refreshTestMinutes=10,\
       testTable=dual,\
       props=user=WL_POOL;password=WL_POOL;server=ipmsherc

weblogic.jdbc.DataSource.IpmsPool=IpmsDevPool
weblogic.allow.reserve.weblogic.jdbc.connectionPool.IpmsDevPool=\
       everyone

In my Java code, get a connection thru the pool like this.

// Get data source via Context

      else if (appServerType.equals("WebLogic")) {
        Hashtable ht = new Hashtable();
        ht.put(Context.INITIAL_CONTEXT_FACTORY,
          "weblogic.jndi.WLInitialContextFactory");
        ht.put(Context.PROVIDER_URL,"t3://localhost:7001");
        ctx = new InitialContext(ht);
        ds = (DataSource) ctx.lookup(connPoolName);
      }

// Get connection
        conn = ds.getConnection();

I hope this helps.
Dave

-----Original Message-----
From: Lyra Marcos [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 10, 2001 10:06 AM
To: [EMAIL PROTECTED]
Subject: JDBC in WEBLOGIC error


Hi,

        I need to access an oracle database by using WebLOGIC connection
pools in a Servlet. The following code shows my dilema:

queryLeitura = "SELECT  NUM_IF FROM OPER.PRECO where NUM_ID_PRECO < 575002
";

try {
        Driver myDriver =
(Driver)Class.forName("weblogic.jdbc.pool.Driver").newInstance();
        Connection conn =
myDriver.connect("jdbc:weblogic:pool:oraclePool",null);
        Statement stmt = conn.createStatement();
        stmt.execute(queryLeitura);
        ResultSet rs = stmt.getResultSet();
        rs.next();
        s=rs.getInt("NUM_IF");
        stmt.close();
        conn.close();
        return (s);}


catch(SQLException ex) {
                        System.err.println("SQLException: " +
ex.getMessage());
                }

I got an error that says: " Does not support SQL execution with no Global
transaction"

Please, What am I missing?



Regards

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to