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