Subject Re: Database connection
Author Roman Rokytskyy
> I would like to set in one place the database connection variables
> like
>
> Class.forName ("org.firebirdsql.jdbc.FBDriver") ;
> java.sql.Connection connection = java.sql.DriverManager.getConnection
> ("jdbc:firebirdsql:192.168.0.115/3050:
> /home/firebird/data/database.fdb?lc_ctype=ISO8859_1","SYSDBA","passwd");
>
> so if the database or passwd change, I only have to change it at one
> place.
>
>
> Thus some one have an idea or example?

In shell you just export

export ISC_USER=SYSDBA
export ISC_PASSWORD=masterkey

and in Java you use:

String user = System.getenv("ISC_USER");
String password = System.getenv("ISC_PASSWORD");

if (user == null || password == null)
throw new MyException("Either user name or password is not set.");

java.sql.Connection connection =
java.sql.DriverManager.getConnection(
"jdbc:firebirdsql:192.168.0.115/3050:/database.fdb",
user,
password
);



Roman