1 package org.smartlib.pool.test; 2 3 import java.sql.*; 4 import org.smartlib.pool.core.*; 5 import javax.naming.*; 6 import javax.sql.*; 7 8 11 12 public class SampleConnectionProviderImpl implements ConnectionProvider { 13 14 15 private DataSource dataSource = null; 16 17 public SampleConnectionProviderImpl() throws Exception { 18 19 InitialContext ic = new InitialContext(); 20 dataSource = (DataSource)ic.lookup("MyPool"); 21 22 } 23 24 25 public Connection getConnection() throws Exception { 26 27 return dataSource.getConnection(); 28 29 } 30 31 public void returnConnection(Connection conn) throws Exception { 32 33 conn.close(); 34 35 } 36 37 38 39 } 40 | Popular Tags |