Java examples for JDBC:Connection
get h2 Connection
//package com.java2s; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class Main { private static String username = "root"; private static String password = ""; private static String url = "jdbc:h2:E:/h2/qq;AUTO_SERVER=TRUE"; private static String driver = "org.h2.Driver"; public static Connection getConnection() { Connection conn = null;/*from w w w . j a va 2s . co m*/ try { Class.forName(driver); conn = DriverManager.getConnection(url, username, password); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } return conn; } }