Properties settings = new Properties();
String ejbpath= System.getProperties().getProperty("catalina.base")+"//deploy//eartest.ear//ejbtest.jar";
try{
settings.load(new FileInputStream(ejbpath+"//ejb//index//bean//ApplicationResources.properties"));
}catch(Exception e)
{
e.printStackTrace();
}
String hostip=settings.getProperty("hostip");
String databasename=settings.getProperty("databasename");
System.out.print(hostip);
System.out.print(databasename);
// String url="jdbc:mysql://localhost:3306/oa?useUnicode=true&characterEncoding=GBK";
String url="jdbc:mysql://"+hostip+":3306/"+databasename+"?useUnicode=true&characterEncoding=GBK";
Class.forName("com.mysql.jdbc.Driver");