get Connection from hsql database - Java java.sql

Java examples for java.sql:hsql

Description

get Connection from hsql database

Demo Code


//package com.java2s;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class Main {
    public static void main(String[] argv) throws Exception {
        System.out.println(getConnection());
    }//ww w  . j  av a  2s .  c om

    public static Connection getConnection() throws SQLException,
            ClassNotFoundException {
        Class.forName("org.hsqldb.jdbcDriver");
        return DriverManager.getConnection("jdbc:hsqldb:mem", "sa", "");
    }
}

Related Tutorials