Connecting to databases via J2EE application servers using the RazorSQL JDBC Bridge
The RazorSQL JDBC Bridge provides the ability for users to interact with databases without making a direct connection to the database. Instead, the user connects to the RazorSQL JDBC Bridge, which then connects to the database. The RazorSQL JDBC Bridge is a JSP (JavaServer Page) that can be deployed in any Java Servlet container, such as Websphere, Weblogic, Tomcat, etc.
Some reasons for using the JDBC Bridge are the following:
1. Security: If your application server supports SSL, using the RazorSQL JDBC Bridge is an easy way to securely transmit any data from your local machine to your database instance.
2. Remote Access: Many times corporations have firewalls that prevent communication on non-standard ports. Using the RazorSQL JDBC Bridge, database communication can be achieved using the standard web ports, 80 for HTTP and 443 for HTTPS, that are not affected by firewalls.
The RazorSQL JDBC Bridge file is located here:
<RazorSQL Install Directory>/bridge/razorsql_jdbc_bridge.jsp
To deploy the bridge, simply copy this file to a Java Servlet container or application server.
The RazorSQL JDBC Bridge can work via either HTTP or HTTPS. If retrieving sensitive data, it is recommended that HTTPS be used.
The RazorSQL JDBC Bridge provides the ability to supply a bridge password. Only calls to the bridge that include a correct password will be handled. The bridge ships with a default password of radmin. It is recommended that this password be changed. To change the password, simply replace the radmin in the following line of the bridge JSP page with another password.
String checkPassword = "radmin";
Accessing the Bridge
Once the bridge JSP page is deployed to an application server, the bridge can be called via either HTTP or HTTPS. When adding a connection profile that will communicate via the RazorSQL JDBC Bridge, there is a field available called the Bridge URL. Simply provide the URL for the deployed bridge JSP page here.
The bridge has the ability to obtain database connections in two ways, either via a JDBC driver or via a custom Java class available on the application server that returns a database connection.
To connect via a JDBC driver, the driver must be available to the application server where the bridge is deployed. When adding a connection profile, simply enter in the JDBC driver and database information such as the driver class, JDBC URL, database login, and database password. The bridge will use that data to make a connection to the database from the application server.
To connect via a custom Java class, first create a class that returns a java.sql.Connection object and make this class available to the application server. Then, when adding a connection profile, simply provide the bridge with the fully qualified class name and the method of the class used to return the connection. The method must not take any parameters.
Since the bridge does not hold on to connections, but instead opens and closes connections for each call, the bridge cannot do multiple fetches to the database for the same query. Because of this, there is a field call "max rows to return" located in the add connection profile screen when setting up the bridge. The value of this field tells the bridge the maximum number of rows to fetch per query. If set too high, this could cause performance problems.
There are certain features of RazorSQL that are not available when using the RazorSQL JDBC bridge. The Execute Procedure/Function tool is not available. Also, all connections via the bridge are set to auto commit since connections are not held onto by the bridge.