JDBC configuration (workspace/jdbc/)
1. Basics
- JDBC connections are used for datasources, security, etc.
- JDBC connections are defined independant of the application using it.
- Each JDBC connection may be used by multiple deegree 3 applications.
- Each JDBC connection has its own configuration file.
- Each configuration file contains exactly one JDBC connection.
JDBC configuration files are located in the jdbc directory of the deegree workspace. See the workspace directory layout for details.
- The name of the configuration file (without the file ending) determins the identifier for this JDBC connection.
- Configuration files need to refer to a specific schema version.
2. Schema location
The schema for defining deegree 3 JDBC connections may be found at http://schemas.deegree.org/jdbc/. It is mandatory to refer to a specific version of the schema, as the schema may change over time.
3. Configuration details
Current Version: 3.0.0 (valid since 2010-11-15)
The <JDBCConnection> defines a jdbc connection that can be referenced in other documents by using its identifier (the file name).
List of supported attributes and elements for <JDBCConnection>
configVersion (attribute): mandatory. Needs to match the version of the referenced schema.
Url: mandatory. The URL of the database as string.
User: mandatory. The user name for the database as sting.
Password: mandatory. The password of the user for the database as string.
ReadOnly: optional (default: false). Possible values: true, false.
true = the jdbc connection can only be used to read from the database.
false = the jdbc connection can be used for transactions (read and write).
3.1. PostgreSQL/PostGIS example
<JDBCConnection
configVersion="3.0.0"
xmlns="http://www.deegree.org/jdbc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.deegree.org/jdbc http://schemas.deegree.org/jdbc/3.0.0/jdbc.xsd">
<!-- [1] JDBC URL (without username / password) -->
<Url>jdbc:postgresql://localhost:5432/my_database_name</Url>
<!-- [1] DB username -->
<User>my_db_username</User>
<!-- [1] DB password -->
<Password>my_db_password</Password>
</JDBCConnection>
3.2. Oracle example
<JDBCConnection
configVersion="3.0.0"
xmlns="http://www.deegree.org/jdbc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.deegree.org/jdbc http://schemas.deegree.org/jdbc/3.0.0/jdbc.xsd">
<!-- [1] JDBC URL (without username / password) -->
<Url>jdbc:oracle:thin:@localhost:1521:oraclesid</Url>
<!-- [1] DB username -->
<User>my_db_username</User>
<!-- [1] DB password -->
<Password>my_db_password</Password>
</JDBCConnection>
Please make sure, to have the required Oracle libs added to the service, as these are not distributed with deegree because of licence restrictions.
3.3. MySQL example
<JDBCConnection
configVersion="3.0.0"
xmlns="http://www.deegree.org/jdbc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.deegree.org/jdbc http://schemas.deegree.org/jdbc/3.0.0/jdbc.xsd">
<!-- [1] JDBC URL (without username / password) -->
<Url>jdbc:mysql://localhost:3306/my_database_name</Url>
<!-- [1] DB username -->
<User>my_db_username</User>
<!-- [1] DB password -->
<Password>my_db_password</Password>
</JDBCConnection>
Please make sure, to have the required MySQL-connector jar added to the WEB-INF/lib/ folder.
4. Further information
Learn how to add a new JDBC connection with the easy to use services console.
For other parts of the workspace configuration please consult the following pages: