I am trying to create a Java class where it will connect to a MySQL database and will extract the data from the tables.
I followed this tutorial. But the problem is I do not know the data coming from the tables as :
- We have more than 1 table and
- We are dealing with a quit big table.
The connection is established but I cannot write data to the XML file.
My code so far for the connection part is:
public class ExtractTo {
static String driverName = "com.mysql.jdbc.Driver";
static String connectURL = "jdbc:mysql://localhost/[database_name]?";
// static String user="root";
//static String password="";
static Statement stmt=null;
static Connection db = null;
static ResultSet rslt=null;
private static String SQLquery="SELECT * FROM [TABLE_NAME]";
static ResultSetMetaData resultmetadata = null;
static Document dataDoc=null;
static Document Doc=null;
public static void main(String [] args) {
try {
Class.forName(driverName).newInstance();
db = DriverManager.getConnection(connectURL+"user=root&password=");
stmt=db.createStatement();
rslt=stmt.executeQuery(SQLquery);
} [all the catch] ...
}