Here you can find the source of loadCfg(String url)
Description:TODO
Parameter | Description |
---|---|
url | a parameter |
private static int loadCfg(String url)
//package com.java2s; //License from project: Apache License import java.io.IOException; import java.io.InputStream; import java.util.Properties; public class Main { private static String DRIVER = null; private static String URL = null; private static String USERNAME = null; private static String PASSWORD = null; private static int SUCCESS = 0; private static int FAILURE = -1; /**// www .j a v a 2 s. c o m * <p>Description:TODO</p> * @param url * @return * @author lijw * @since 2013-3-5 */ private static int loadCfg(String url) { Properties prop = new Properties(); InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(url); try { prop.load(in); DRIVER = prop.get("jdbc.driverClassName").toString(); URL = prop.get("jdbc.url").toString(); USERNAME = prop.get("jdbc.username").toString(); PASSWORD = prop.get("jdbc.password").toString(); } catch (IOException e) { e.printStackTrace(); return FAILURE; } return SUCCESS; } }