MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

import org.w3c.dom.Document;

import com.sun.org.apache.xml.internal.serialize.XMLSerializer;

public class MainClass {

    public static void main(String[] args) {

        try {
            Class.forName("COM.cloudscape.core.JDBCDriver").newInstance();

            Connection conn = DriverManager.getConnection("jdbc:cloudscape:GAMETRADER");

            Statement s = conn.createStatement();

            ResultSet rs = s.executeQuery("SELECT * FROM tableName");

            while (rs.next()) {
                int id = rs.getInt("GAMEID");
                Document manual = (Document) rs.getObject("MANUAL");
                XMLSerializer serialize = new XMLSerializer(System.out, null);
                serialize.serialize(manual);
            }

        } catch (Throwable e) {
            System.out.println("exception thrown");
            System.out.println(e);
        }
    }
}