×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: ActionScript
Posted by: Leszek Downarowicz
Added: Mar 7, 2015 7:33 PM
Views: 8
Tags: no tags
  1.  private Connection DBConnection;
  2.   public Connection connect() {
  3.         try {
  4.             Class.forName("com.mysql.jdbc.Driver");
  5.             System.out.println("Connection OK");
  6.         } catch (ClassNotFoundException cnfe) {
  7.             System.out.println("Connection Error" + cnfe);
  8.         }
  9.         String url = "jdbc:mysql://www.xxxx.at/xxxxxx";
  10.         String dbname = "xxxx";
  11.         String password = "xxxxx";
  12.         try {
  13.                 DBConnection = (Connection) DriverManager.getConnection(url, dbname, password);
  14.             System.out.println("DB Connection OK");
  15.         } catch (SQLException es) {
  16.             System.out.println("DB Not Fond Error" + es);
  17.         }
  18.     return DBConnection;
  19.     }