You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Mike Wilson <mw...@yahoo.com> on 2006/03/23 19:11:34 UTC

DaoConfig questions please

Hello,
   
  We are trying to connect to a physical database and running JPetStore 5 on Tomcat 4.0.2. For our DaoConfig file, we have three questions:
   
  First, will it work to set the connection using the SimpleDataSource like this:
  DataSource dataSource = new SimpleDataSource(props);          
  conn = dataSource.getConnection();
   
  Second, we know we won't need this now (this worked great btw), but is there something we need to do for the physical connection in place of this, or nothing at all?:
  //            ScriptRunner runner = new ScriptRunner(conn, false, false);
//            runner.setErrorLogWriter(null);
//            runner.setLogWriter(null);
//            runner.runScript(Resources.getResourceAsReader("ddl/hssql/jpetstore-hssql-schema.sql"));
//            runner.runScript(Resources.getResourceAsReader("ddl/hssql/jpetstore-hssql-dataload.sql"));
   
  Third, for the DaoManager method, we're not sure what Resources method we would use in place of the getResourceAsReader which is grabbing the resource and passing to the Reader, or would we still use this?:
   
  public static DaoManager newDaoManager(Properties props) {
    try {
      Reader reader = Resources.getResourceAsReader(resource);
      return DaoManagerBuilder.buildDaoManager(reader, props);
    } catch (Exception e) {
      throw new RuntimeException("Could not initialize DaoConfig.  Cause: " + e, e);
    }
   
  This is a great product and we have it so it's building properly with the JUnit tests and so forth. If we can get past this one stumbling block (which has had us stumped over a day now) it will be something we can use in production and a great learning tool for a couple of our developers. Any help would really be greatly appreciated.
   
  Thank you all in advance,
  Mike

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com