Orion already pools the connection for you. Just reference the pooled
datasouce:

Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup( "jdbc/pooled/MypooledDS" );
Connection conn = ds.getConnection();

This will get you a connection from the pool, and return it when you close
the connection.

-----Original Message-----
From: dan moy <[EMAIL PROTECTED]>
To: Orion-Interest <[EMAIL PROTECTED]>
Date: Thursday, September 07, 2000 12:20 PM
Subject: SQL Server DB Pooling


>Hello,
>I am interested in setting up database pooling using INet's Opta driver for
>SQL server, but I am having trouble with the configuration.
>
>I can get the driver manager for single connections to work, but if I try
>any of the pooled conections I am getting a Cast exception.
>
>Any help would be appreciated!  Thanks,
>Dan
>
>Here is my configuration:
>
>
><data-source
> class="com.evermind.sql.ConnectionDataSource"
> location="jdbc/MyCoreDS"
> pooled-location="jdbc/pooled/MypooledDS"
> xa-location="jdbc/xa/MyXADS"
> ejb-location="jdbc/MyDS"
> name="My data-source"
> url="jdbc:inetdae:SQLSERVERA:1433"
> connection-driver="com.inet.tds.TdsDriver"
> username="sa"
> password=""
>/>
>
>Here is the code I am using to test this connection:
>
>
> PooledConnection pcon = null;
> Connection con = null;
> int i=0;
>
> System.out.println("Starting");
> try {
>        Context ctx = new InitialContext();
>
>/*
>      DataSource ds = (DataSource)ctx.lookup("jdbc/MyCoreDS");
>      con = ds.getConnection();
>*/
>        ConnectionPoolDataSource ds =
>(ConnectionPoolDataSource)ctx.lookup("jdbc/MyDS");
>        pcon = ds.getPooledConnection();
>        con = pcon.getConnection();
>
>        Statement s = con.createStatement();
>        ResultSet rs = s.executeQuery("select * from sysmessages");
>
>        while (rs.next()) {
>%>
><tr>
> <td><%= i++ %></td>
> <td><%= rs.getString(4) %></td>
></tr>
><%
>        }
>
>        rs.close();
>        s.close();
> }
>
> catch (NamingException e)

> System.out.println(e.toString());
> }
> catch (SQLException e) {
> System.out.println(e.toString());
> }
> finally

> if (pcon != null)
> try {
> pcon.close();
> }
> catch(Exception e) {
> System.out.println(e.toString());
> }
> }
>
>
>
>
>
>
>
>
>_______________________________________________________
>Say Bye to Slow Internet!
>http://www.home.com/xinbox/signup.html
>


Reply via email to