You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Alex Chen <al...@sbcglobal.net> on 2006/02/02 03:37:44 UTC

DB user name and password

Currently the only way I know is to specify the user name and password 
for DB connection via torque is through a property file:

torque.defaults.connection.user = dbuser
torque.defaults.connection.password = dbpassword

and then call Torque.init( String propertyFile)

This is open the chance of someone looking at the file and getting 
access to the DB.

Is there other way to initialize Torque so that I can set the DB 
user/password separately, e.g. via some property setting at runtime?

Alex


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: DB user name and password

Posted by Trevor Miller <we...@fox5.co.za>.
What I like to do for web applications is to put the properties file in a
jar file and then use a class loader to read it. Since the jar file is in
the lib dir of the web application, nobody can download it and unjar it
which provides some security. Of course this is still not 100% secure.

Another way would be to hard code the username and password in your
application, but this means that you have to recompile if the username and
password should change, which might not be a good idea.

Trevor

> Currently the only way I know is to specify the user name and password
> for DB connection via torque is through a property file:
>
> torque.defaults.connection.user = dbuser
> torque.defaults.connection.password = dbpassword
>
> and then call Torque.init( String propertyFile)
>
> This is open the chance of someone looking at the file and getting
> access to the DB.
>
> Is there other way to initialize Torque so that I can set the DB
> user/password separately, e.g. via some property setting at runtime?
>
> Alex
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: DB user name and password

Posted by Alvaro Coronel <al...@yahoo.com>.
Try this:
  conf = new BaseConfiguration();
  conf.setProperty("torque.database.default","testdb");
  conf.setProperty("torque.database.factucopi.adapter","mysql");
  conf.setProperty("torque.dsfactory.factucopi.factory","org.apache.torque.dsfactory.SharedPoolDataSourceFactory");  conf.setProperty("torque.dsfactory.factucopi.connection.driver","com.mysql.jdbc.Driver");  conf.setProperty("torque.dsfactory.factucopi.connection.url","jdbc:mysql://localhost:3306/testdb?useCompression=true");
  conf.setProperty("torque.dsfactory.factucopi.connection.user","testusr");                 conf.setProperty("torque.dsfactory.factucopi.connection.password","wy,09+p");
  Torque.init(conf);
  

Alex Chen <al...@sbcglobal.net> wrote:  Currently the only way I know is to specify the user name and password 
for DB connection via torque is through a property file:

torque.defaults.connection.user = dbuser
torque.defaults.connection.password = dbpassword

and then call Torque.init( String propertyFile)

This is open the chance of someone looking at the file and getting 
access to the DB.

Is there other way to initialize Torque so that I can set the DB 
user/password separately, e.g. via some property setting at runtime?

Alex


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org



		
---------------------------------
 
 What are the most popular cars? Find out at Yahoo! Autos