|
|
This section contains the information on a simple database viewing tool in a hope that it may be useful for someone else except myself.
DB Tool
Quick download: dbtool.jar (45kB). To start: java -jar dbtool.jar
General information.
Installation and startup.
Using the DB tool.
Sample environments.
Sample URL and Driver syntax.
General information.
DB Tool is a simple database viewing utility implemented in Java with JDBC. It provides client-side sorting and allows you to see the table structure information. It should work on any hardware/software platform that runs Java 2 and has appropriate JDBC drivers for your database. Please see sample screenshots later on this page.
For obvious reasons, it's not a commercial software - it's just too simple and therefore provided as-is and without support and warranties. If you will want to send me some kind of feedback on DB Tool please use the form available by clicking the Feedback button on the left of this page.
Installation and startup.
The main prerequisites are that you should have Java Runtime and JDBC drivers for your databases installed. Most of development work was done using Java 1.3.1, and the later versions should be fine as well.
The JDBC drivers (their JAR files) should be listed on your CLASSPATH or alternatively, you can copy them into lib/ext directory of your JRE tree. In the last case be careful if you have several JREs installed; in Windows, SUN installs JRE in two locations: one with JDK and the second in Program Files.
If you want to use ODBC to connect to the database, please note that not all the databases provide the access to necessary metadata that is required for DB Tool to work. For example, ODBC connection to Oracle works in the same way as with native Oracle drivers, but I could not find the way to work with MS Access.
Next, download the JAR file dbtool.jar (45kB) and put it into the directory of your choice. Now you should be able to run the DB tool from the command line (after having set the current directory to one where the JAR file is):
java -jar dbtool.jar
Or, if you are using Windows and don't want to have the command window to hang around, create a shortcut with command line like:
javaw -jar dbtool.jar
Using the DB tool.
Upon the start as described above, you will be presented with a connection screen:
The database URL and the driver class name are mandatory. The class name and the URL syntax can be found from the documentation provided by your database vendor. Some sample values are given below.
Fill in the user name and password if necessary. The checkbox "Get tables for all users" should be checked if you want to access the database schemas of all the users in the DB instance (naturally, you have to have SELECT granted to you).
Alternatively, you can use the list of cached values in the bottom part of the logon screen. The values in this list are saved in the dbtool.properties file which is created in your home directory. (On Windows NT/XP-like systems it's the value of USERPROFILE variable that you can see by typing 'set' in the command prompt; on consumer Windows it's normally something like C:\WINDOWS).
You can have the DB tool save not only your connection URL, driver class and user name, but the password too by checking the checkbox on the logon screen. Be careful! The passwords are saved in clear text and if your are on multi-user system, anyone with appropriate permissions will be able to read your database password. Use this feature only if your are the sole user on the machine/network and if your database data is not sensitive (and backed up regularly).
When your are ready with input parameters, click Connect. If your are using the cache list and passwords are saved too, double-click on the appropriate line in the list. If your logon parameters are wrong, the DB tool with issue a message and get you back to the input.
After having the DB connection successfully established, the DB tool opens the main view window with the database tables list on the left. Select the table you want to get its contents displayed in the right pane. Only the columns whose content can be represented as text will be displayed (binary objects will not be shown). The first column shows the record number; the record numbers don't change their order when the list is sorted - it's just for convenience when viewing large datasets.
In the right pane you will have two pages: table content and the table structure. The table structure is shown below. The first column named "K" has value of "Y" if the column is a key column. When you switch to this pane for the very first time, the table columns are ordered in the same way as they are in the physical database (if you sort the list, then the order is lost).
Both content and structure can be sorted by one selected column by clicking on the column header. Normal click sorts the records ascending and Shift-click sorts in the descending order.
You can work with several databases at the same time. To open a new connection, select the menu File - New Connection and fill in the logon data.
Sample environments.
The DB tool did not go through a real testing process. However, this section lists the systems where the tool was developed or tried on different stages. This section is not a warranty though that the tool will work on all those systems.
OS
|
JDK
|
DB
|
Windows NT 4.0
|
1.3.x
|
Oracle 8.x (native driver and through ODBC too)
|
Windows NT 4.0
|
1.3.x
|
SAP DB
|
Windows XP Pro
|
1.3.x
|
Oracle 8.x (native driver and through ODBC too)
|
Windows ME
|
1.3.x
|
MySQL 3.x
|
Sun Solaris 8
|
1.3.x
|
Oracle 8.x
|
FreeBSD 4.6
|
JDK 1.4 (JDK for Linux, under binary compatibility mode)
|
MySQL 3.x
|
If you will have a different environment to add to this list please report it to me.
Sample URL and Driver syntax.
Database
|
Driver
|
URL
|
MySQL
|
com.mysql.jdbc.Driver
|
jdbc\:mysql\://hostname/DBname
|
Oracle (native driver)
|
oracle.jdbc.driver.OracleDriver
|
jdbc:oracle:thin:@hostname:PortNumber:DBname Port number is normally 1521
|
SAP DB
|
com.sap.dbtech.jdbc.DriverSapDB
|
jdbc:sapdb://hostname/DBname
|
ODBC via SUN ODBC Bridge
|
sun.jdbc.odbc.JdbcOdbcDriver
|
jdbc:odbc:ODBCdataSourceName
|
|
|