Home

  

Product

  

Buy

  

Support

 First Line 
 FAQs 
 Tutorials 
 Registered Users 
 User Guide 
 Knowledge Base 

News

  

Press

  

Downloads

  

Contact

  

Company

  

Partners

  

Resources

 
 

User Guide - Appendix A - Database configuration

Index    Previous   <<>>  Next
  
16.1 Overview

16.2 Example URLs

  16.1  OverviewTo top of page

  1. Overview
  2. Most Java Database Connectivity (JDBC) drivers can be downloaded for free from your database vendor's website. They are usually distributed in a compressed format (i.e. zip file). Installation of the driver on your system depends on the type of the driver and can be vendor specific. We recommend using type 4 JDBC drivers with JCodeBox at least initially so that if you have any connectivity problems, they are easier to resolve. Installation of most type 4 JDBC drivers usually just involves expanding the downloaded file onto your hard disk. Once expanded, the driver is usually in an archive file format (i.e. jar or zip). Consult your database vendor's documentation for details specific to your driver.

  3. Register driver
    • In the main JCodeBox window, right mouse click on Database Drivers and select Add Driver...

    • The Add Driver dialog will be displayed.

    • Enter a name for your driver (e.g. PostgreSQL)
    • Use the Browse button to locate the JDBC driver file/archive (e.g. jconn2.jar for Sybase)

    • Consult your database vendor's documentation for details specific to your driver.
      If JCodeBox doesn't automatically locate the JDBC driver class in the archive, enter the class name into the class field. If your driver consists of multiple files, select one of the files in the Add Driver dialog and add the others directly to the JCodeBox classpath using the Edit Classpath dialog (Tools->Classpath... menu)

    • Click OK to commit your changes then re-start JCodeBox for the changes to take effect.
    • Repeat the above for any other JDBC drivers you wish to use with JCodeBox.
    • Your driver(s) should now be displayed in the main JCodeBox window. If a driver is shown in read it means JCodeBox was unable to load the necessary driver classes (either the driver class name or the location could be incorrect). To correct this right mouse click on the driver, choose Edit... and correct the class name/location for the driver.

  4. Add connection
    • In the main JCodeBox window, right mouse click on a Database Driver and select Add Connection...

    • The Add Connection dialog will be displayed.

    • Enter a name for your connection (e.g. CustomerDB)
    • Enter the URL for your connection

    • Consult your database vendor's documentation for the exact format of the URL (Also see our Sample JDBC URLs section at the end of this chapter).

    • Enter the User ID required to connect to this database
    • Enter the password required to connect to this database
    • Click OK to commit your changes.

  5. Test connection
    • Double click on the connection to see a list of available schemas/catalogs

    • If an error message is displayed, correct the error and retry.

    • Double click on a schema/catalog to see a list of available table types
    • Double click on a table type to see a list of available tables
    • Double click on a table to see it's definition displayed in the right hand window pane
    • You can now generate J2EE applications directly from a database.
      Simply right mouse click on a connection and select Generate Application.

  16.2  Example URLsTo top of page

Database Driver Version Driver Class Basic URL format Examples
Sybase (jConnect) 5.2 com.sybase.jdbc2.jdbc.SybDriver jdbc:sybase:Tds: host: port/database

To connect to a database called inventory on host myhost* using port 3698 use the following URL
jdbc:sybase:Tds:myhost:3698/inventory

Oracle 8.1.6.2.0 oracle.jdbc.driver.OracleDriver For the Thin Driver
jdbc:oracle:thin: @<database>

To connect to a database called inventory on host myhost* using port 1521 and SID ORADB1 use the following url:

jdbc:oracle:thin:@myhost:1521:ORADB1

 

PostgreSQL 7.0.1.2 org.postgresql.Driver jdbc:postgresql: //host:port/ database

To connect to a database called inventory on host myhost* using port 5432 use the following url:

jdbc:postgresql://myhost:5432/inventory

MySQL 2.0.7 org.gjt.mm.mysql.Driver jdbc:mysql: //hostname: port/dbname

To connect to a database called inventory on host myhost* using port 1234 use the following url:

jdbc:mysql://myhost:1234/inventory

 

*Usually you can swap the host name for the IP address

Index    Previous   <<>>  Next

Copyright Michael Campbell Associates Ltd. 1999-2003. All Rights Reserved