这是代码
你少了个分号,应该为:
String sql="select * from NULLID.user_info_table;";
在cloud执行下
select * from NULLID.user_info_table
在cloud执行下select * from NULLID.user_info_table
jdbc链接都是一个模式 就那几步
第一步:class.forname("db2驱动路径")
第二部:创建connection对象 connection = DriverManager.getConnection(url, username, password);
第三步:准备执行语句 PreparedStatement pst = connection.prepareStatement(sql);
第四步:结果读取
ResultSet result = pst.executeQuery();
ResultSetMetaData method = result.getMetaData();
List methodList = new ArrayList();
for(int i=1;i<=method.getColumnCount();i++){
methodList.add(method.getColumnName(i));
}
while(result.next()){
Map map = new HashMap();
for(int j=0;j<methodList.size();j++){
String key = methodList.get(j);
map.put(key, result.getObject(key));
}
resultList.add(map);
}
认真回答每个问题 如满意 请采纳 谢谢