|
|
|
@ -4,10 +4,12 @@ import com.fr.base.FRContext;
|
|
|
|
|
import com.fr.file.DatasourceManager; |
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
import com.fr.stable.ParameterProvider; |
|
|
|
|
|
|
|
|
|
import java.sql.Connection; |
|
|
|
|
import java.sql.DriverManager; |
|
|
|
|
import java.sql.ResultSet; |
|
|
|
|
import java.sql.ResultSetMetaData; |
|
|
|
|
import java.sql.SQLException; |
|
|
|
|
import java.sql.Statement; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
|
@ -93,10 +95,11 @@ public class ParamTableDataDemo extends AbstractTableData {
|
|
|
|
|
// 保存得到的结果集
|
|
|
|
|
valueList = new ArrayList(); |
|
|
|
|
// 下面开始建立数据库连接,按照刚才的SQL语句进行查询
|
|
|
|
|
// 根据连接名获取FR数据连接定义的数据连接,如果没有定义,也可以参考getConnection方法自己创建连接
|
|
|
|
|
com.fr.data.impl.Connection conn = DatasourceManager.getInstance().getConnection("FRDemo"); |
|
|
|
|
|
|
|
|
|
Connection con = null; |
|
|
|
|
try { |
|
|
|
|
Connection con = conn.createConnection(); |
|
|
|
|
con = conn.createConnection(); |
|
|
|
|
Statement stmt = con.createStatement(); |
|
|
|
|
ResultSet rs = stmt.executeQuery(sql); |
|
|
|
|
// 获得记录的详细信息,然后获得总列数
|
|
|
|
@ -119,7 +122,15 @@ public class ParamTableDataDemo extends AbstractTableData {
|
|
|
|
|
// 打印一共取到的数据行数量
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
} finally { |
|
|
|
|
if (con != null) { |
|
|
|
|
try { |
|
|
|
|
con.close(); |
|
|
|
|
} catch (SQLException e) { |
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|