create Connection for derby - Java JDBC

Java examples for JDBC:Connection

Description

create Connection for derby

Demo Code


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

public class Main {
    public static Connection createConnection() {
        Connection conn;//from   w ww.ja  va2  s.c o  m
        try {
            String url = "jdbc:derby://localhost/db;create=true";

            conn = DriverManager.getConnection(url, "app", "123");
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return conn;
    }
}

Related Tutorials