Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try { Class.forName("com.ibm.db2.jdbc.app.DB2Driver");
- } catch (ClassNotFoundException e) {
- System.out.println("Please include Classpath Where your DB2 Driver is located");
- e.printStackTrace();
- return;
- } System.out.println("DB2 driver is loaded successfully");
- Connection conn = null;
- PreparedStatement pstmt = null;
- ResultSet rset=null;
- boolean found=false;
- try {
- conn = DriverManager.getConnection("jdbc:db2:DB2PDBA","USERID","PASSWORD");
- if (conn != null)
- {
- System.out.println("DB2 Database Connected");
- }
- else
- {
- System.out.println("Db2 connection Failed ");
- }
Add Comment
Please, Sign In to add comment