Dont take this as gospel, but this seems to work for me:

1. Create the non connection pooled entry: (this uses odbc so noncpe would
be set up as and ODBC datasource)

 <data-source class="com.evermind.sql.ConnectionDataSource"
location="jdbc/NonCPE">
  <name>Default data-source</name>
  <description>
   This is a generic data-source that takes it's generates Connections with
   ordinary JDBC 2.0 drivers.
  </description>
  <url>jdbc:odbc:noncpe</url>
  <connection-driver>sun.jdbc.odbc.JdbcOdbcDriver</connection-driver>
  <username>name</username>
  <password>password</password>
 </data-source>


2. Create teh connection pooled entry that points to the Non CPE.
 <data-source class="com.evermind.sql.DefaultConnectionPoolDataSource"
location="jdbc/CPE">
  <name>Connection pooled entrydata-source</name>
  <description>
   This is a ConnectionPooldata-source.
  </description>
  <source-location>jdbc/NonCPE</source-location>
  <username>name</username>
  <password>password</password>
 </data-source>

3.   Now, this is the part that seems to work for me, but appears not to
coincide with the overview of the optional package:
(http://java.sun.com/j2ee/bulletin/jdbc_2/extension.html)

Context ctx = new InitialContext();
ConnectionPoolDataSource ds =
(ConnectionPoolDataSource)ctx.lookup("jdbc/SiteCodeFAQ");
Connection con =
((PooledConnection)ds.getPooledConnection()).getConnection();



Now does anyone know what the repurcusions are if you use a 1.1 or 1.2
driver with JDBC 2.0?

good luck.  I think for newcomers it might be nice if people offered some
assistance on setting up some of this basic stuff.  If a posting is good,
maybe that can quickly make it into the FAQ on the Orion homepage.   It
might help the orion developers along.

steve



----- Original Message -----
From: Mike Cannon-Brookes <[EMAIL PROTECTED]>
To: Orion-Interest@Orionserver. Com <[EMAIL PROTECTED]>
Sent: Sunday, November 07, 1999 12:41 AM
Subject: Datasources


> G'day all,
>
> How does one use the datasources and connection pools created by
> datasources.xml ?
>
> I believe I have created a pool and a datasource (see below) and Orion
> starts up with no errors. How can grab a connection object now to access
the
> db? Sample code most appreciated ;) I'm trying to access it from a
servlet.
>
> <data-source class="com.evermind.sql.ConnectionDataSource"
> location="jdbc/BMBDS">
> <name>BookmarkBox Datasource</name>
> <url>jdbc:odbc:BookmarkSQL</url>
> <connection-driver>sun.jdbc.odbc.JdbcOdbcDriver</connection-driver>
> <username>mike</username>
> <password>XXXXXX</password>
> </data-source>
>
> <data-source class="com.evermind.sql.DefaultConnectionPoolDataSource"
> location="jdbc/BMBPooledDS">
> <name>BookmarkBox ConnectionPool data-source</name>
> <source-location>jdbc/BMBDS</source-location>
> <username>mike</username>
> <password>XXXXXX</password>
> <inactivity-timeout>300</inactivity-timeout>
> <max-connections>5</max-connections>
> </data-source>
>
>
> Cheers,
> Mike
>
>

Reply via email to