connect To derby DataBase - Java java.sql

Java examples for java.sql:Derby

Description

connect To derby 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 {
        connectToDataBase();//from   w w  w. ja va  2 s .  c o  m
    }

    private static Connection veza;

    public static void connectToDataBase() {
        try {
            veza = DriverManager.getConnection("jdbc:derby:baza/MyDB",
                    "test", "test");
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

Related Tutorials