嗨,我是 java 新手,我正在使用来自数组的循环插入到数据库中,这需要时间我将如何在 DB 中插入数据作为批量插入我的代码,
if(con != null)
{
rs = dboperation.DBselectstatement(con,"select host_object_id from nagios_hosts where address='"+ip+"'");
if (rs != null)
{
rs.next();
String id = rs.getString(1);
for(int i= 0;i<serviceArray.length;i++)
{
status.append(serviceArray[i]+"\n");
dboperation.DbupdateStatement(DbAcess.getNagios_connection(),"insert into nagios_servicelist(service_name,host_object_id) values('"+serviceArray[i]+"','"+id+"')");
}
}
}
不要详细介绍这段代码在数据库中批量插入?
希望很快能听到你的声音
提前致谢