Results 1 to 2 of 2
- 12-17-2009, 09:30 PM #1
Member
- Join Date
- Dec 2009
- Posts
- 1
- Rep Power
- 0
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.
- 12-18-2009, 02:16 AM #2
if you are getting a database is encrypted error ?
that must mean the database has been set up to use password or security key protection.
By default sqlite databases are not password protected, so you would need to find out what password was used to set this up on this database.
Would you be able to use a tool to create a new test sqlite database and fill it with a couple test tables, and then use this connector to try to read from that ?
Similar Threads
-
How to convert a table
By gilbertsavier in forum JDBCReplies: 0Last Post: 07-17-2009, 08:25 AM -
How to convert access database to mysql database?
By vrk in forum Advanced JavaReplies: 2Last Post: 02-11-2009, 05:43 AM -
How to bind a tree with checkboxes to a database table
By happyday in forum SWT / JFaceReplies: 0Last Post: 01-20-2009, 04:28 PM -
Updating database table from JTable
By yesjava in forum New To JavaReplies: 1Last Post: 08-16-2008, 11:16 PM -
Modifying data in database table using PreparedStatement
By Java Tip in forum Java TipReplies: 0Last Post: 02-09-2008, 09:22 PM
Bookmarks