| |
package com.wisdom;
import java.lang.stringbuffer; import java.sql.connection; import java.sql.preparedstatement; import java.sql.drivermanager; import java.sql.*; import com.wisdom.base.dateutil;
public class test { public test() { }
public static void main(string[] args) { test test = new test(); connection conn = null;
try { class.forname("com.ibm.db2.jcc.db2driver"); conn = drivermanager.getconnection( "jdbc:db2://192.168.0.93:50000/cpicsms", "administrator", "rose");// test.save(conn);
} catch (sqlexception ex) { ex.printstacktrace(); } catch (classnotfoundexception ex) { } finally { try { if (conn != null) { conn.close(); } } catch (sqlexception ex1) { } }
}
private void save(connection conn) { if (conn == null) return;
preparedstatement pstmt = null; stringbuffer sb = new stringbuffer(""); sb.append("insert into sm_prioritysend_sm_list(serviceid, smcontent, sendtarget, priority, rcompletetimebegin,") .append( " rcompletetimeend, rcompletehourbegin, rcompletehourend, requesttime, roadby,") .append( "sendtargetdesc,ogidentity, feevalue, linkid, pad1, pad2, pad3, pad4, pad5)") .append(" values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); string sql = sb.tostring();
try { pstmt = conn.preparestatement(sql);
for (int i=0;i<2000;i++ ) { pstmt.setstring(1, "111"); pstmt.setstring(2, "12121'''中文中文中文中文中文中文中文中文中文中文中文中文中文中文中文中文中文中文中文中文中文中文中文'''2"); pstmt.setstring(3, "13840015338"); pstmt.setint(4, 1); pstmt.setdate(5, dateutil.getcurrentdate()); pstmt.setdate(6, dateutil.getcurrentdate()); pstmt.setint(7, 1); pstmt.setint(8, 1439);
pstmt.settimestamp(9, dateutil.getcurrenttimestamp());
pstmt.setint(10, 1);
pstmt.setstring(11, "|srzf|100|12|||");
pstmt.setstring(12, "10000"); pstmt.setfloat(13, 0);
pstmt.setstring(14, "sadfasfd"); pstmt.setstring(15, "sadfasfd"); pstmt.setstring(16, "sadfasfd"); pstmt.setstring(17, "sadfasfd"); pstmt.setstring(18, "sadfasfd"); pstmt.setstring(19, "sadfasfd");
pstmt.executeupdate(); } } catch (sqlexception ex) { ex.printstacktrace(); } finally { try { if (pstmt != null) { pstmt.close(); } } catch (sqlexception ex1) { } }
}
}
|
|