SQLExecutor是一个简单的JDBC框架,只需要一个jar包足以。支持Oracle,mySQL,HSQL,和PostgreSQL等数据库,可轻易扩展支持新的数据库。
示例代码:
publicstaticvoidtestSimpleSelectWithParams(){Strigsql="SELECT*FROMJDBC_TESTWHERETEST_ID<?ANDTEST_DT<?";CoectioPoolcoPool=ewCoectioPool(1,driverName,coURL,userame,password);SQLExecutorsqlExec=ewSQLExecutor(coPool);sqlExec.addParam(ewIteger(8));//additparamwithvalue=8sqlExec.addParam(Date.valueOf("2003-05-10"));//adddateparamwithvalue5/10/03SQLResultsres=sqlExec.ruQueryCloseCo(sql);//rusthequery,closescoectioSystem.out.pritl(res.toStrig());//displayetireresultsetitabularform}






评论