public class Main {
public static void main(String[] args) throws SQLException {
BasicDataSource ds = new BasicDataSource();
ds.setDriverClassName("org.h2.Driver");
ds.setUrl("jdbc:h2:C:/Users/Pathum/Documents/My Java
Projects/JavaDB/target/db");
ds.setUsername("sa");
ds.setPassword("");
try (Connection connection = ds.getConnection()) {
System.out.println("Connected");
} finally {
ds.close();
}
/*try (Connection connection = DriverManager
.getConnection(
"jdbc:h2:C:/Users/Pathum/Documents/My Java
Projects/JavaDB/target/db",
"sa", "")) {
System.out.println("Connected");*/