Java examples for java.sql:DB2
get Connection from DB2 Database
//package com.java2s; import java.sql.Connection; import java.sql.DriverManager; public class Main { public static void main(String[] argv) throws Exception { System.out.println(getConnection()); }//from w ww .j a v a 2s. c om public static Connection getConnection() { String url = "jdbc:db2://localhost:50000/icmpdb:currentSchema=ICMPDB;"; String user = "db2admin"; String password = "123**123"; Connection conn = null; try { Class.forName("com.ibm.db2.jcc.DB2Driver").newInstance(); conn = DriverManager.getConnection(url, user, password); } catch (Exception e) { e.printStackTrace(); } return conn; } }