Just so that I am understanding this correctly, would it be possible for you
to provide a resources.xml sample, the web.xml snippet and a small code for
datasource from initialcontext lookup - ??

Mine are here :-

Resources.xml ( in WEB-INF folder of deployed war)
        <Resource id="jdbc/localDB" type="javax.sql.DataSource">
                JdbcDriver com.mysql.jdbc.Driver
            JdbcUrl jdbc:mysql://localhost:3306/localdatabase
            MaxActive 100 
            MaxIdle 30 
            MaxWait 10000
            UserName username
            Password password
        </Resource>

web.xml (  in WEB-INF folder of deployed war)

<resource-ref>
                <description>MySQL Connection</description>
                <res-ref-name>jdbc/locallDB</res-ref-name>
                <res-type>javax.sql.DataSource</res-type>
                <res-auth>Container</res-auth>
        </resource-ref>
        

Code to lookup and use datasource

InitialContext ic = new InitialContext();
Context envCtx = (Context) ic.lookup("java:comp/env");
DataSource ds = (DataSource)envCtx.lookup("jdbc/localDB");




--
View this message in context: 
http://openejb.979440.n4.nabble.com/MySQL-resource-in-Tomee-1-5-2-tp4665872p4665892.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Reply via email to