Adilol

aasd

Dec 3rd, 2011
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.27 KB | None | 0 0
  1. package com.coal.storage;
  2. import java.io.FileInputStream;
  3. import java.io.FileNotFoundException;
  4. import java.io.IOException;
  5. import java.util.Properties;
  6.  
  7. import com.coal.core.CoalEnvironment;
  8. import com.jolbox.bonecp.*;
  9. import org.gjt.mm.mysql.Driver;
  10.  
  11. public class dbConnect
  12. {
  13.      String NewPath = "";
  14.      String AppPath = new CoalEnvironment().getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
  15.      {
  16.      if (AppPath.contains("indigo.jar")) {
  17.              NewPath = AppPath.replace("indigo.jar", "");
  18.      } else {
  19.              NewPath = AppPath;
  20.      }
  21.  
  22.     public static void jdbcheck(){
  23.  
  24.     try {
  25.        
  26.         Class.forName("org.gjt.mm.mysql.Driver");
  27.     } catch (Exception e) {
  28.  
  29.         System.out.println("System exit caused by" + e); //hay gais we iz in troubles
  30.        
  31.     }
  32.    
  33. }
  34.     public static void dbcon(){
  35.           Properties configFile = new Properties();
  36.           try {
  37.             configFile.load(new FileInputStream("coal.properties"));
  38.         } catch (FileNotFoundException e) {
  39.             // TODO Auto-generated catch block
  40.             System.out.println("File does not exist");
  41.             System.exit(1);
  42.             e.printStackTrace();
  43.         } catch (IOException e) {
  44.             // TODO Auto-generated catch block
  45.             e.printStackTrace();
  46.             System.out.println("File IO error");
  47.             System.exit(1);
  48.         }
  49.     }
  50.    
  51. }
  52.  
Advertisement
Add Comment
Please, Sign In to add comment