How to convert Sqlite database table into XML file
I need help on this.
I need to I need to query an sqlite database and export a table from there into an xml file??
The two libraries I'm using are JDOM and SQLite.
I can establish a connection but then I get an error message saying that the file is encrypted>???
Here is what I have so far:
private void ConvertBtnActionPerformed(java.awt.event.ActionEve nt evt) {
// When convert button is pressed, connection to database will be made
// file will be converted
Connection connection = null;
ResultSet resultSet = null;
Statement statement = null;
try {
Class.forName("org.sqlite.JDBC");
connection = DriverManager.getConnection("jdbc:sqlite:C:\\Users \\Sun\\Desktop\\finalexam2009.db");
statement = connection.createStatement();
//query employee table for all records
//create xml using jdom libraries
resultSet = statement.executeQuery("SELECT EMPNAME FROM EMPLOYEE");
while (resultSet.next()) {
System.out.println("EMPLOYEE NAME:"
+ resultSet.getString("EMPNAME"));
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
resultSet.close();
statement.close();
connection.close();
} catch (Exception e) {
e.printStackTrace();
}
}
//when conversion is complete, show a message dialog box saying that conversion is complete
}
I don't know what to do next, have been looking around everywhere.
Thank You.