
Connection con = DriverManagergetConnection("localhost", "user", "password");
Statement stmt = concreateStatement();
ResultSet rs = stmtexecuteSql("select from tables");
List list = new ArrayList();
while (rshasNext())
{
listadd(rsgetString(1));
}
String[] array = listtoArray();
代码如下:
public byte[] blob2ByteArr(Blob blob) throws Exception {
byte[] b = null;
try {
if (blob != null) {
long in = 0;
b = blobgetBytes(in, (int) (bloblength()));
}
} catch (Exception e) {
eprintStackTrace();
throw new Exception("fault");
}
return b;
}
把while($row = mysql_fetch_array($result,MYSQL_ASSOC))
改成while($row = mysql_fetch_array($result,MYSQL_NUM))这个就行了,
具体的去查下mysql_fetch_array这个函数就行了
如果我的回答没能帮助您,请继续追问。
以上就是关于通过JDBC把数据库读取出来,放到List里 通过List接口里的toArray()转换为数组 具体的代码是什么啊全部的内容,包括:通过JDBC把数据库读取出来,放到List里 通过List接口里的toArray()转换为数组 具体的代码是什么啊、如何把oracle数据库里的blob类型的数据转换为byte数组、用php怎么把mysql数据库表转成二维数组等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)