public void writeTRJ(String filename, int reldepth, String release) {

		File file = new File(filename);
		BufferedReader br = null;
		String ln = null;

		try {
			br = new BufferedReader(new FileReader(file));
			br.readLine();
			ln = br.readLine();
			while (ln != null) {
				StringTokenizer stk = new StringTokenizer(ln);
				if (stk.countTokens() != 10) {
					System.out
							.println("WARNING: Number of fields must equal 10 (contains "
									+ stk.countTokens()
									+ ").  Skipping "
									+ filename + "...");
					ps1.clearBatch();
					return;
				}
				ps1.setString(
						1,
						file.getName().substring(0,
								file.getName().lastIndexOf("."))); // Source
				ps1.setInt(2, reldepth);
				ps1.setInt(3, Integer.parseInt(stk.nextToken())); // Index
				Timestamp ts = null;
				try {
					String s = stk.nextToken() + " " + stk.nextToken();
					if (s.contains(":")) {
						ts = new Timestamp(df1.parse(s).getTime());
					} else {
						ts = new Timestamp(df2.parse(s).getTime());
					}
				} catch (ParseException e) {
					System.out
							.println("WARNING: Date could not be parsed from "
									+ ln + ".  Continuing");
					ln = br.readLine();
					continue;
				}
				ps1.setTimestamp(4, ts); // Time
				ps1.setDouble(5, Double.parseDouble(stk.nextToken())); // Duration
				double depth = Double.parseDouble(stk.nextToken());
				ps1.setDouble(6, depth); // Depth
				double longitude = Double.parseDouble(stk.nextToken());
				ps1.setDouble(7, longitude); // Longitude
				double latitude = Double.parseDouble(stk.nextToken());
				ps1.setDouble(8, latitude); // Latitude
				ps1.setDouble(9, Double.parseDouble(stk.nextToken())); // Distance
				String status = stk.nextToken();
				if (!status.startsWith("\"S")) {
					ps1.setString(10, status); // Status
					ps1.setString(11, "");
				} else {
					ps1.setString(10, "S");
					ps1.setString(11, status.substring(2, status.length() - 1));
				}
				ps1.setBoolean(12, Boolean.parseBoolean(stk.nextToken())); // NoData
				ps1.setString(13, release);
				ps1.setDouble(14, longitude);
				ps1.setDouble(15, latitude);
				ps1.setDouble(16, depth);
				// ps1.execute();
				ln = br.readLine();
				ps1.addBatch();
			}
			ps1.executeBatch();
		} catch (IOException e) {
			e.printStackTrace();
		} catch (SQLException sq) {
			sq.printStackTrace();
		} finally {
			if (br != null) {
				try {
					br.close();
				} catch (IOException e) {
				}
			}
		}
		// System.out.println(filename + " processing complete");
	}