Here is an example of using java .properties files taken from the `CCPKI` project.
import java.sql.* ;
import java.util.Properties ;
import java.IO.File ;
File f = new File( "com/scripps/crypto/PKI.properties" ) ;
if( f.exists() )
{
Properties p = new Properties() ;
p.load( new FileInputStream( f ) ) ;
System.out.println("loading jdbc properties from " + f + "\n" + p) ;
Class.forName( p.getProperty( "jdbc.class" ) ) ;
conn = DriverManager.getConnection(
p.getProperty( "jdbc.connectString" ),
p.getProperty( "jdbc.dbLogin"),
p.getProperty( "jdbc.dbPass" ) ) ;
}
The corresponding file then looks like :
jdbc.class=oracle.jdbc.driver.OracleDriver
jdbc.connectString=jdbc:oracle:thin:@xxx.xxx.xxx.xx:1521:SID1
jdbc.dbLogin=scott
jdbc.dbPass=tiger