Guest User

Untitled

a guest
Dec 1st, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. try { Class.forName("com.ibm.db2.jdbc.app.DB2Driver");
  2. } catch (ClassNotFoundException e) {
  3. System.out.println("Please include Classpath Where your DB2 Driver is located");
  4. e.printStackTrace();
  5. return;
  6. } System.out.println("DB2 driver is loaded successfully");
  7. Connection conn = null;
  8. PreparedStatement pstmt = null;
  9. ResultSet rset=null;
  10. boolean found=false;
  11. try {
  12. conn = DriverManager.getConnection("jdbc:db2:DB2PDBA","USERID","PASSWORD");
  13. if (conn != null)
  14. {
  15. System.out.println("DB2 Database Connected");
  16. }
  17. else
  18. {
  19. System.out.println("Db2 connection Failed ");
  20. }
Add Comment
Please, Sign In to add comment