RazorSQL Getting Connected with JDBC or ODBC
RazorSQL can connect to databases using a piece of software known as a JDBC driver. A JDBC driver is a collection of Java classes and possibly native software that handles the process of connecting to and communicating with a database. Database vendors provide JDBC drivers, usually free of charge, so that software developers can write code to connect to the specific database vendor's database without having to worry about vendor specific coding. Because of this, a software developer can connect to multiple types of databases using the same programming code. The vendor specific data communication details are handled by the JDBC driver. Since RazorSQL communicates with databases using JDBC drivers, RazorSQL can connect to any database that provides a functional JDBC driver.
On Windows machines, RazorSQL also ships with a built-in JDBC-ODBC bridge. Thus, RazorSQL can also connect to a database using an ODBC data source. No external JDBC drivers are required for this type of connection.
RazorSQL ships with JDBC drivers for certain databases - DB2, Derby, Firebird, Frontbase, HSQLDB, Informix, OpenBase, Oracle, PostgreSQL, SQLite, SQL Anywhere, SQL Server, and Sybase ASE - and includes an auto-install feature for the MySQL driver. Therefore, RazorSQL can connect to these databases out of the box. However, many database vendors do not allow distribution of their JDBC drivers even though the vendors allow downloading of the JDBC drivers for free. Because of this, for certain databases, the RazorSQL user is required to download the JDBC driver to their machine, and tell the RazorSQL software where the driver file was downloaded. For more information about where to find JDBC drivers for specific database products, see the following web page:
This document will now talk about the database connection process.
The first step to connecting to a database through RazorSQL is to create a connection profile. To create a connection profile, launch RazorSQL and then select Connections -> Add Connection Profile. This launches the Connection Wizard process.
Once you have arrived at the Add Connection Profile tab, you will be presented with a choice of various database vendors to select from in a list. If the database type you wish to connect to is found in list, select it. Otherwise, select the OTHER option at the bottom of the list.
After selecting the database type, the next step is to select the connection type. The Connection Type list contains a JDBC option, an ODBC option (Windows only), and may contain built-in JDBC driver information if RazorSQL ships with JDBC drivers for the database vendor selected in the previous step. Select whether you want to connect via the built-in JDBC driver (if available), JDBC, or ODBC (Windows only).
After selecting the connection type, the next step is to enter the driver and database information. If you selected a built-in driver, the driver information will be completed for you. The following fields may be shown depending on your previous selections:
PROFILE NAME: After creating a connection profile, RazorSQL displays a list of created profiles in a drop-down box. Enter the name you would like to appear in that box here.
DRIVER LOCATION: The location of the JDBC driver file on your machine. This field applies to JDBC connections only. The driver file is usually a .jar or .zip file. If the driver requires multiple files, separate the complete file paths with semi-colons.
DRIVER CLASS: The Java driver class to be called for the JDBC driver. Consult your driver documentation to determine the name of this class. This field applies to JDBC connections only.
LOGIN: If the database you wish to connect to requires a user name or login id, enter that information in the login field.
PASSWORD: If the database you wish to connect to requires a password, enter that information in the password field.
SAVE PASSWORD: If you wish RazorSQL to save the database password on your machine so you do not need to re-type it, check the Save Password checkbox. RazorSQL does encrypt the password so that it is not stored in clear text.
HOST: This is the name or IP address of the machine on which the database is running. If the database is running on the local machine, this value would be localhost or 127.0.0.1. This value is usually only optional if the database is running on the local machine.
PORT: This is the port on which the database is listening. Many databases have default ports. If the database has a default port and is set up to listen on the default port, this value can usually be left blank. RazorSQL will prepopulate this field if the database have a known default port. If the database server is not listening on the default port, the prepopulated value will need to be changed.
DATABASE NAME: This can refer to the name or alias of the database you wish to connect to. Often this field is optional. In these cases, it may be left blank.
SERVICE NAME: Some database vendors refer to database identifiers as service names.
SID: Some database vendors refer to database identifiers as an SID.
DATA SOURCE NAME: The name of the ODBC data source that pertains to the database you wish to connect to. This applies to ODBC connections only.
AUTO COMMIT: The auto commit field is used to determine whether RazorSQL should automatically send a commit to the database after each query is executed. If you would like a commit sent to the database after each query is executed, select "Yes" for auto commit, if not, select "No". Some databases may not support transactions or rollbacks. In this case, the auto commit field should be set to "Yes". In other cases, some databases may require the user to manually enter a commit after running each query to function properly. In these cases, it may be more convenient to set auto commit to "Yes". Consult your database documentation for more information on transactions, rollbacks, and commits.
JDBC URL: Each JDBC driver requires a JDBC URL to be passed to the JDBC driver before a connection to the database can be made. This JDBC URL describes certain details about the database such as where it is located and on which port it is running, etc. Each JDBC driver has its own format for the JDBC URL. Consult you JDBC driver documentation for more information regarding the JDBC URL.
After entering the requried information in the connection wizard, hit the "CONNECT" button to attempt to make a connection to the database. If the connection is successful, the profile will be created and stored so that connections can be made at later times, and a new query runner session will be established to the database. If the connection is not successful, an error message received from the JDBC driver will be displayed.