khandelwaldeval khandelwaldeval - 1 year ago 99
Java Question

Accessing h2 database from specified path

How do I access an H2 database from a specified file path say E:\folder\mydb.h2.db in java? What would be the jdbc url for that?

Answer Source

Got an example code from the H2DB tutorial site

import java.sql.*;
public class Test {
    public static void main(String[] a)
            throws Exception {
        Connection conn = DriverManager.
            getConnection("jdbc:h2:E:\\folder\\mydb", "sa", "");
        // add application code here
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download