Accredited Registrar Accredited Registrar

Frequently Asked Question

FAQ / Dedicated JVM

How to set DB Configuration in Java Property file?

For configuration purposes, using properties file is a good way of reusing. In this way, when the code is packaged to a jar file, users can just put the different configurations in the file, instead of recompile the application.

MySQL (mysql-connector-java-5.0.5.jar) drivers should be put into lib directory and added to the project build path. Make sure you are using the correct version of the java drivers according to your database server installation version.

Your application will read the database configuration details from the property files, so that it can easily switch from Oracle to MySQL database and vice versa, just by changing the property details.

<b>#mysql DB properties
<b>#Oracle DB Properties

Database configurations are the most important details when using JDBC API. The first thing we should know is the Driver class to use. For Oracle database, driver class is oracle.jdbc.driver.OracleDriver and for MySQL database, driver class is com.mysql.jdbc.Driver. You will find these driver classes in their respective driver jar files and both of these implement java.sql.Driver interface. ( For Mysql connection string format is jdbc:mysql://<$HOST>;<$PORT>/<$SCHEMA> and for Oracle database connection string format is jdbc:oracle:@<$HOST>;<$PORT>:<$SID>.)

How this faq is helpful:

Not at all
Not much
Some what

What could be better? (Optional)
  Not related to my issue
  Too complicated explanations
  Too much information
  Incorrect information
  Unclear information
  Incomplete information
  Too old information
Do you have any other feedback about this faq ?