package com.yanek.base.database;
import java.io.inputstream;
import java.util.properties;
public class configutil
{
private static properties prop=new properties();
private static boolean isloaded=false;
public configutil()
{
}
public static properties getconfiginfo()
return prop;
static
if (!isloaded)
{
try
{
//inputstream is=new configutil().getclass().getresourceasstream("requestandhandler.properties");
// inputstream is=new configutil().getclass().getresourceasstream("db.properties");
//inputstream is= getservletcontext().getresourceasstream("/web-inf/db.properties");
// inputstream is=new configutil().getclass().getclassloader().getresourceasstream("com/yanek/db/db.properties");
// inputstream is=new configutil().getclass().getclassloader().getresourceasstream("com/yanek/db/dbconfig.properties");
// inputstream is=new configutil().getclass().getresourceasstream("dbconfig.properties");
// inputstream is=new configutil().getclass().getclassloader().getresourceasstream("db.properties");
inputstream is=new configutil().getclass().getclassloader().getresourceasstream("db.properties");
prop.load(is);
isloaded=true;
}
catch(java.io.ioexception ex)
isloaded=false;
ex.printstacktrace();
}
public static string getclassname(string ywdm)
string classname=(string)getconfiginfo().get(ywdm);
return classname;
public static void main(string[] args)
{
string url=(string)configutil.getconfiginfo().get("url");
system.out.println("url="+url);
string driver=(string)configutil.getconfiginfo().get("driver");
system.out.println("driver="+driver);
string user=(string)configutil.getconfiginfo().get("user");
system.out.println("user="+user);
string password=(string)configutil.getconfiginfo().get("password");
system.out.println("password="+password);
}
}