How to create initializeDB() method for java database

Posted by Holly on Stack Overflow See other posts from Stack Overflow or by Holly
Published on 2010-05-10T14:48:49Z Indexed on 2010/05/10 14:54 UTC
Read the original article Hit count: 232

Filed under:
|
|

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();
    }
}

© Stack Overflow or respective owner

Related posts about java

Related posts about database