SQLExecutor - 简单的JDBC框架


未知
跨平台
Java

软件简介

SQLExecutor 是一个简单的 JDBC 框架,只需要一个jar包足以。支持 Oracle, mySQL, HSQL, 和 PostgreSQL
等数据库,可轻易扩展支持新的数据库。

示例代码:

**public static void** testSimpleSelectWithParams()  
{  
    String sql = "SELECT * FROM JDBC_TEST  
                           WHERE TEST_ID < ? AND TEST_DT < ?";  
    ConnectionPool conPool = **new** ConnectionPool(1, driverName,  
                                 conURL, username, password);  
    SQLExecutor sqlExec = **new** SQLExecutor(conPool);  
    sqlExec.addParam( **new** Integer(8));  
               //add int param with value = 8  
    sqlExec.addParam(Date.valueOf("2003-05-10"));  
               //add date param with value 5/10/03  
    SQLResults res = sqlExec.runQueryCloseCon(sql);  
               //runs the query, closes connection  
    System.out.println(res.toString());  
               //display entire result set in tabular form  
}