JDBC Database Connections
The page gives an overview of the Java Database Connection within Orbit.
For more information about Spatial Databases, see Spatial Databases.
What is a Database Connection
Database connections are used for accessing external tables. It is the link between an application and a database.
This connection provides Orbit the information to connect to a given database. These connections are used to point file-based datasets to a database or join external tables to an existing dataset using one ore more key attributes.
In Orbit GIS each Database Connection has an individual name. This connection name is registered with the resource you use it for:
- Joining a database table to a dataset, read: Joins
- accessing spatial databases, read: Spatial Databases
JDBC - Java DataBase Connection
To make a Connection from a Java application to a database, a database driver is required. Many databases provide a Java class to access their database using the SQL language. These are JDBC drivers.
Depending on the Driver, a URL will provide the information the driver needs to establish the connection and allow the application to execute SQL-commands on the database.
Define Connection
Connections can be added
- for desktop: Main Toolbar > Preferences > Database
- for Publisher: Console > Databases
Connection configuration | |
---|---|
Name | The user name of the JDBC Data Source. This is what you will use in Orbit GIS, and it must be unique. |
Description | An optional description of the Data Source. |
Username | The name of the user to access the database with. |
Password | The password for that user. |
Driver | The JDBC Driver to be used. |
URL | The connection string that will allow the application to connect to the database and execute commands. The format of this URL is driver dependant, and you probably need to consult the driver documentation to get the right syntax. |
Test Connection | Complete the connection configuration and click the Test Connection button. The result should be “OK”. If not, check the connection parameters. In most cases, the URL syntax is not properly constructed. If you're not familiar to this issue, consult your IT-manager or java.oracle.com. |
Database Driver | standard URL syntax |
---|---|
MySQL | jdbc:mysql://<hostname>/<database> |
Oracle - Old Syntax | jdbc:oracle:thin:@<hostname>:<port> (default 1521):<sid> jdbc:oracle:thin:<user>/<password>@<hostname>:<port> (default 1521):<sid> |
Oracle - New Syntax | jdbc:oracle:thin:@//<hostname>:<port (default 1521)>/<sid or service> jdbc:oracle:thin:<user>/<password>@//<hostname>:<port (default 1521)>/<sid or service> |
PostgreSQL | jdbc:postgresql://<hostname>/postgres |
SQL Server | jdbc:sqlserver://<hostname:<port> (default 1433);databaseName=<SOMEDB>; |
UCanAccess1) | jdbc:ucanaccess://<filepath> |
Remarks
- Use of “User” and “Password” in the respective connection configuration fields are required. It is not necessary to do this in the URL syntax.
- Use of Microsoft Access Driver, requires some special attention : JDBC Database Drivers