views:

31

answers:

2

I am working on a Java project for class and have not worked much with incorporating databases into Java. I can't find much on the initializeDB() method, but if I could get some help I would really appreciate it.

Below is the code being used for the intializeDB() method:

private void initializeDB() {
    try {
        // Load the JDBC driver

        System.out.println("Driver loaded");

        // Establish a connection

        System.out.println("Database connected");

        // Create a statement

        // Create a SQL Query string

        // Execute the query to create a recordset

    }
    catch (Exception ex) {
        ex.printStackTrace();
    }
}
+2  A: 

check out JDBC Tutorial

Xorty
A: 

You might also find some sample code on the website for your database vendor. For example, if you are using MySQL, you might find these examples helpful.

Phill Sacre