Does this class implement the DataSource (javax.sql) interface?
If it does, you can set it up as a JNDI DataSource, and configure iBATIS to use it that way.
If not...it really should. It is a very simple interface, something
like 3 (maybe 6) methods, and buys you a ton of flexibility when
working with standard Java components (most of which expect a
DataSource).
Larry
On 4/25/05, Folashade Adeyosoye <shardayyy@xxxxxxxxx> wrote:
I have a class that manages my connections, creates connections, gets rid of null connections etc. Basically it manages an array of connections ready for use. To avoid to delay in the time to create a connection.
-----Original Message----- From: Brandon Goodin [mailto:brandon.goodin@xxxxxxxxx] Sent: Monday, April 25, 2005 11:08 PM To:
ibatis-user-java@xxxxxxxxxxxxxxxxxxxx Subject: Re: iBatis Dao Setup
" I have my own connectionManager class" I'm not sure what you mean by this. Please expound on this.
Brandon
On 4/25/05, Folashade Adeyosoye <
shardayyy@xxxxxxxxxxxx> wrote: > > > > Hi all let me see if I can explain my problem and how I have things setup.
> > > > First, my problem is having difficulty converting one of my working and
> deployed applications to using iBatis Dao. I basically yanged out my Dao > factory and try to replace it with iBatis version in hopes to use SQLMAP. > > > > > > Application starts up and calls the
MyExtendedActionServlet.java to load my > cache object (drop downs) > MyExtendedActionServlet.java calls MyServiceImpl.java (Service Layer) which > in turns calls the MysqlSelectionObjectDAO.java
> MysqlSelectionObjectDAO.java makes the jdbc calls to the DB to pull stuff.
> > > > > > Where it fails. > > ============================ > > It fails right here in the
dao.xml file, see dao.xml below. > > > > <snip> > > Reader reader = Resources.getResourceAsReader(resource); > > </snip> > > > >
> > Question: > > Do I still need to define my transactionManager even thou I have my own > connectionManager class - See dao.xml below > > > > > > >
> Any help will be appreciated. > > > > > > > > Package Structure > > ============================ > > > > net.package1.package2 > |
> |_____
domain <package> >
| > > |_____impl <package> > > | > > |_____ MyServiceImpl.java > | > |_____framework
<package> >
| > > |_____MyExtendedActionServlet.java > >
| > |_____
persistence <package> >
| > > |_____iface <package> >
| > > |_____mysql <package> > > > | > > |_____ MysqlSelectionObjectDAO.java >
| > > |_____sqlmapdao <package> >
| > > |_____dao.xml >
| > > |_____DaoConfig.java > > > > > > > > MyExtendedActionServlet.java : > > ============================ > > > > // load the countires
> > ArrayList countires = new ArrayList(); > > countires = api.loadDropDownMenu(Constants.DROP_MENU_COUNTRY, false);
> > > getServletContext().setAttribute(appProp.getValue
("lookup.country"), > countires); > > logger.debug("COUNTRIES LOADED..."); > > > > > > > > > > > > >
> MysqlSelectionObjectDAO.java: > > ============================ > > > >
<snip/> - the program is not even getting to this point... > > > > > > > > dao.xml > > ============================ > > > > <daoConfig>
> > > > <properties resource=" > net/package1/package2/properties/database_local.properties"/> > > > > <context> > > <transactionManager type="JDBC">
> > <property name="DataSource" value="SIMPLE"/> > > <property name="JDBC.Driver" value="${driver}"/> > > <property name="
JDBC.ConnectionURL" value="${url}"/> > > <property name="JDBC.Username" value="${username}"/> > > <property name="JDBC.Password" value="${password}"/>
> > <property name="JDBC.DefaultAutoCommit" value="true"/> > > <property name="Pool.MaximumActiveConnections" value="10"/> >
> <property name="Pool.MaximumIdleConnections" value="5"/> > > <property name="Pool.MaximumCheckoutTime" value="120000"/> > > </transactionManager>
> > > > <dao interface=" > net.package1.package2.persistence.iface.SelectionObjectDAO" > implementation=" > net.package1.package2.persistence.mysql.MysqlSelectionObjectDAO
"/> > > </context> > > </daoConfig> > > > > > > DaoConfig.java > > ============================ > > > > public class DaoConfig {
> > > > private static final DaoManager DAO_MANAGER; > > > > static { > > > > try { > > String resource = " > net/package1/package2/persistence/dao.xml";
> > Reader reader = Resources.getResourceAsReader(resource); > > DAO_MANAGER = > DaoManagerBuilder.buildDaoManager(reader); > > System.out.println("Finished getting the DAO_MANAGER...");
> > } catch (Exception e) { > > throw new RuntimeException("Could not initialize DaoConfig. Cause: " > + e); > > } > > } > >
> > public static DaoManager getDaomanager() { > > return DAO_MANAGER; > > } > > > > } > > > > > > > >
> > ---------- ERROR - start --------------- > > <snip> > > DEBUG[2005-Apr-25 13:17:49] - > jdbc.SimpleDataSource(SimpleDataSource.java:407) - SimpleDataSource > forcefully closed/removed all connections.
> > ApplicationDispatcher[/myContext]: Servlet.service() for > servlet debugjsp threw exception > > java.lang.NoClassDefFoundError > > at net. package1. > package2.domain.impl.MyServiceImpl
.<init>(MyServiceImpl.java:34) > > at net. package1. > package2.framework.taglib.BuildBirthdayListTag.<init>(BuildBirthdayListTag.j ava:73) > > </snip>
> > ---------- ERROR - start --------------- > > > > > >
|
|