Saturday, December 8, 2012

How to connect different databases with HSQL client

To connect different databases with HSQL client. this is very useful in a production environment, where a single client (in fact, just a jar file and lightweight) can connect to multiple databases.

prerequisites:
1. hsql.jar
2. jdbc driver for the target database.


steps:
1. Start the HSQL client in command prompt.
2. enter the following command.

    window: java –cp hsqldb.jar;<JDBC DIRVER>.jar; org.hsqldb.util.DatabaseManager
    linux: java –cp hsqldb.jar:<JDBC DIRVER>.jar org.hsqldb.util.DatabaseManager

3. enter jdbc url, jdbc class, user name, password in the follow dialog.

Database Driver class jdbc url
Oracle oracle.jdbc.OracleDriver jdbc:oracle:thin:@<host>:<port>:<sid>
MSSQL net.sourceforge.jtds.jdbc.Driver jdbc:jtds:sqlserver://<host>:<port>/<database>
Sybase net.sourceforge.jtds.jdbc.Driver jdbc:jtds:sybase://<host>:<port>/<database>
DB2 com.ibm.db2.jcc.DB2Driver jdbc:db2://<host>:<port>/<database> 
MySQL com.mysql.jdbc.Driver jdbc:mysql://<host>:<port>/<database>
informix com.informix.jdbc.IfxDriver jdbc:informix-sqli://<host>:<port>/<database>
PostgreSQL org.postgresql.Driver jdbc:postgresql://<host>:<port>/<database>

4. Click Ok
5. Done!

No comments:

Post a Comment

LinkWithin

Related Posts Plugin for WordPress, Blogger...