Hi, I'm running into some issue with implementing a DAO. I see posts that some design use a DaoFactory, I don't understand the benefit of it. Is it possible to obtain connections instead of using a Factory?
For example: In my XXXAction class, I have BeanDao beandao = new BeanDao(); beandao.executeQuery(sql, VO); The BeanDao extends BaseDao, which has the following, where name is "java:comp/env/jdbc/myDatasource" protected Connection getConnection(String name) throws DatabaseUnavailableException{ Connection conn = null; try { InitialContext ic = new InitialContext(); DataSource ds = (DataSource) ic.lookup(name); if (ds==null) throw new DatabaseUnavailableException("Cannot connect to database: "+name); try { conn = ds.getConnection(); } catch (SQLException e) { // log e.printStackTrace(); } } catch (NamingException e) { //e.printStackTrace(); } return conn; } This however, doesn't work, I get this error: java.sql.SQLException: No suitable driver at java.sql.DriverManager.getDriver(DriverManager.java:243) at tyrex.jdbc.xa.EnabledDataSource.getConnection(EnabledDataSource.java:233) at tyrex.jdbc.xa.EnabledDataSource.getConnection(EnabledDataSource.java:204) The even odder thing is that instead of DataSource ds = (DataSource) ic.lookup(name); I explicitly call using DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/myDatasource"); I don't get the above SQL error, instead, I get a java.lang.NullPointerException when I try to use the connection. I'm using Tomcat 4.03 with Struts 1.1 + Sybase jconn2.jar If anyone can shed some light on this, I'd really appreciate it. I looked up on the tomcat mailing-list archive and didn't see any solutions. Thanks, Dean Chen -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>