How to get JDBC Connection to HSQL Database in Java?

Below code snippet shows you to get the JDBC connection in java. To get the JDBC connection you will need JDBC Driver Jar for HSQLDB.

/****************************************************************************************
 * Created on 04-2011 Copyright(c) http://kodehelp.com All Rights Reserved.
 ****************************************************************************************/
package com.kodehelp.javasql;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * Created by http://kodehelp.com
 * Date: 4/29/11
 */
public class GetHSQLConnection{
    public static void main(String [] args) throws SQLException, ClassNotFoundException {
        Class.forName("org.hsqldb.jdbcDriver");
        System.out.println("Driver Loaded.");
        final String URL = "jdbc:hsqldb:data/tutorial";
        Connection conn = DriverManager.getConnection(URL, "SA", "");
    }
}

Please Post Your Comments & Reviews

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.