Code example for PreparedStatement

Methods: executeUpdatesetDoublesetIntsetStringsetTimestamp

0
		lastLocs.put(thisDataIndex, loc);
 
		// String query = 
		// "insert into AIS_tracks (daveVal, name, latVal, longVal, courseVal, speedVal) VALUES ("; 
		int ctr = 1;
		sql.setTimestamp(ctr++, new java.sql.Timestamp(date2.getTime()));
		sql.setString(ctr++, name2);
		sql.setDouble(ctr++, coords2.getY());
		sql.setDouble(ctr++, coords2.getX());
		sql.setDouble(ctr++, course2);
		sql.setDouble(ctr++, speed2);
		sql.setInt(ctr++, index2);
		sql.setInt(ctr++, thisDataIndex);
		sql.setString(ctr++, color);
		 sql.executeUpdate();
 
		places++;
	} 
 
	private static class NumberedTimePeriod extends TimePeriod.BaseTimePeriod 
Stop searching for code, let great code find you!  Add Codota to your java IDE