Roberts, Eric wrote:

Try this way instead - it works for me!
Thanks, I'll try it. I just thought that I cat use Oracle dbcp implementation only, without BasicDataSourceFactory Tomcat alternative.

Server.xml:
<Resource description="Oracle database resource for esljsp project" name="jdbc/esljsp-oracle" auth="Container" type="javax.sql.DataSource"/>
.
.
<ResourceParams name="jdbc/esljsp-oracle">
.
.
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:@db.server.ru:1521:sidvalue</value>
</parameter>.
.

web.xml:
.
.
<resource-ref>
<description>Oracle database resource for esljsp project</description>
<res-ref-name>jdbc/esljsp-oracle</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
.
.

Source:
.
.
import javax.naming.Context;
import javax.naming.InitialContext;
.
.
ctx = new InitialContext();
Context envCtx = (Context) ctx.lookup("java:/comp/env/");
DataSource ds = (DataSource) envCtx.lookup("/esljsp-oracle");

Hope this helps!

--= [ original post cut ] =--


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to