Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.coal.storage;
- import java.io.FileInputStream;
- import java.io.FileNotFoundException;
- import java.io.IOException;
- import java.util.Properties;
- import com.coal.core.CoalEnvironment;
- import com.jolbox.bonecp.*;
- import org.gjt.mm.mysql.Driver;
- public class dbConnect
- {
- String NewPath = "";
- String AppPath = new CoalEnvironment().getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
- {
- if (AppPath.contains("indigo.jar")) {
- NewPath = AppPath.replace("indigo.jar", "");
- } else {
- NewPath = AppPath;
- }
- public static void jdbcheck(){
- try {
- Class.forName("org.gjt.mm.mysql.Driver");
- } catch (Exception e) {
- System.out.println("System exit caused by" + e); //hay gais we iz in troubles
- }
- }
- public static void dbcon(){
- Properties configFile = new Properties();
- try {
- configFile.load(new FileInputStream("coal.properties"));
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- System.out.println("File does not exist");
- System.exit(1);
- e.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- System.out.println("File IO error");
- System.exit(1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment