	private void saveCSV(File folderToSaveIn, File databaseFile) throws Exception {
		Connection c = null;
		Statement statement = null;
		File fileNameToSaveAs = new File(folderToSaveIn, databaseFile.getName() + ".csv");
		BufferedWriter w = null;
		boolean success = false;
		try {
			w = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileNameToSaveAs), "UTF-8"));
			c = getConnection(databaseFile.getAbsolutePath());
			statement = c.createStatement();
			statement
					.execute("select datetime(ZCREATIONDATE + 978307200 ,'unixepoch', 'localtime') as CreationDate, datetime(ZMODIFICATIONDATE + 978307200 ,'unixepoch', 'localtime') as ModificationDate, ZTITLE as Title, (ZCONTENT) as Content,ZNOTE.Z_PK as Z_PK, ZCREATIONDATE, ZMODIFICATIONDATE from ZNOTE, ZNOTEBODY where ZNOTE.ZBODY = ZNOTEBODY.Z_PK order by ZMODIFICATIONDATE");
			ResultSet rs = statement.getResultSet();
			String headerLine = createCsvLine("Z_PK", "ZCREATIONDATE", "ZMODIFICATIONDATE", "CreationDate","ModificationDate","Title","Content");
			w.write(headerLine);
			while (rs.next()) {
				String bodyLine = createCsvLine(rs.getString("CreationDate"),rs.getString("ModificationDate"),rs.getString("Title"),"<html><body>" + rs.getString("Content") + "</body></html>", rs.getString("Z_PK"), rs.getString("ZCREATIONDATE"), rs.getString("ZMODIFICATIONDATE"));
				w.write(bodyLine);
			}
			success = true;
		} catch (SQLException e) {
			throw e;
		} finally {
			try {
				if (statement != null) {
					statement.close();
				}
			} catch (Exception e) {
			}
			try {
				if (c != null) {
					c.close();
				}
			} catch (Exception e) {
			}
			try {
				if (w != null) {
					w.flush();
					w.close();
				}
			} catch (Exception e) {
			}
			if (!success) {
				fileNameToSaveAs.delete();
			}
		}
	}

	private void saveCSV(File folderToSaveIn, File databaseFile) throws Exception {
		Connection c = null;
		Statement statement = null;
		File fileNameToSaveAs = new File(folderToSaveIn, databaseFile.getName() + ".csv");
		BufferedWriter w = null;
		boolean success = false;
		try {
			w = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileNameToSaveAs), "UTF-8"));
			c = getConnection(databaseFile.getAbsolutePath());
			statement = c.createStatement();
			statement
					.execute("select datetime(ZCREATIONDATE + 978307200 ,'unixepoch', 'localtime') as CreationDate, datetime(ZMODIFICATIONDATE + 978307200 ,'unixepoch', 'localtime') as ModificationDate, ZTITLE as Title, (ZCONTENT) as Content,ZNOTE.Z_PK as Z_PK, ZCREATIONDATE, ZMODIFICATIONDATE from ZNOTE, ZNOTEBODY where ZNOTE.ZBODY = ZNOTEBODY.Z_PK order by ZMODIFICATIONDATE");
			ResultSet rs = statement.getResultSet();
			String headerLine = createCsvLine( "CreationDate","ModificationDate","Title","Content", "Z_PK", "ZCREATIONDATE","ZMODIFICATIONDATE");
			w.write(headerLine);
			while (rs.next()) {
				String bodyLine = createCsvLine(rs.getString("CreationDate"),rs.getString("ModificationDate"),rs.getString("Title"),"<html><body>" + rs.getString("Content") + "</body></html>", rs.getString("Z_PK"), rs.getString("ZCREATIONDATE"), rs.getString("ZMODIFICATIONDATE"));
				w.write(bodyLine);
			}
			success = true;
		} catch (SQLException e) {
			throw e;
		} finally {
			try {
				if (statement != null) {
					statement.close();
				}
			} catch (Exception e) {
			}
			try {
				if (c != null) {
					c.close();
				}
			} catch (Exception e) {
			}
			try {
				if (w != null) {
					w.flush();
					w.close();
				}
			} catch (Exception e) {
			}
			if (!success) {
				fileNameToSaveAs.delete();
			}
		}
	}
