Section | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
- Stop the Standalone Database Connector
Edit the dbconnector.properties in the database-connector-2.5.x\config directory of the standalone installation. The dbconnector.properties file is where you can customize database connection properties (such as server port) and configure datasource definitions. Add the datasource definitions for your querysets/queries to this file then save it.
If all of your querysets are run against the same database, you can add these properties to define the datasource for all of them. The example shown below is for a MySQL database.Code Block # Customize the DbConnector here logging.file=./logs/database-connector.%d{yyyy-MM-dd}.log server.port=8081 dbconnector.queryset.resource-def.url=<the url to your database> dbconnector.queryset.resource-def.user=<your database username> dbconnector.queryset.resource-def.password=<your database password>
If your querysets are run against different databases, then you must configure the resource definition for each one.
Code Block # Customize the DbConnector here logging.file=./logs/database-connector.%d{yyyy-MM-dd}.log server.port=8081 dbconnector.queryset@myStore.resource-def.url=jdbc:mysql://database1:3306/classicmodels dbconnector.queryset@myStore.resource-def.user=root dbconnector.queryset@myStore.resource-def.password=root dbconnector.queryset@BIRT.resource-def.url=jdbc:mysql://database2:1433/studentdb dbconnector.queryset@BIRT.resource-def.user=root dbconnector.queryset@BIRT.resource-def.password=root
Let's take a look at the properties in this example:
- the server.port property specifies the default port number for the standalone Database Connector. If you are running it on a different port, change the port number here
- the logging.file property creates a database logfile in database-connector-2.5.x\logs named database-connector.YYYY-MM-DD
- the next section provides the resource URL, database user and password for the myStore queryset which is run against a MySQL database named classicmodels on port 3306 on a server named database1
the next section provides the resource URL, database user and password for the BIRT queryset which is run against a MySQL database named studentdb on port 1433 on a server named database2
Tip You can see more examples of datasource definitions here
Create your configuration.xml file in the <db-home>\database\database-connector-2.5.x\config directory. Add the contents below, which defines querysets named myStore and BIRT, to your configuration.xml file to get you started. Refer to the Defining SQL Queries topic for detailed information about the configuration.xml file content.
Code Block <dbconnector> <queryset name="myStore"> </queryset> <queryset name="BIRT"> </queryset> </dbconnector>
Restart the connector using one of these methods:
Open a command prompt and navigate to the <db-home>\database\database-connector-2.5.x directory
Type java -jar database.warClick the Restart-DBConnector-Service.bat,sh to restart the service for your operating system if you instl. Click below for a list of the batch files and shell scripts that come with the connector.
Expand title Click here Insert excerpt frevvo72:DB Connector Installation frevvo72:DB Connector Installation nopanel true
Browse the http://localhost:8081/database/status page
Verify that query validation page is loaded with status Passed and is pointing to your custom configuration.xml file.
Database Connector FAQ
What is a database URL?
A database URL is a Universal Resource Locator (URL) that specifies a particular type of database server compatible with the JDBC driver you installed. In addition you can also specify the database name to use for the connection.
...
Check with your database administrator or the documentation for your database drive for details on the correct database URL format.
Can I add other parameters to the database URL?
You can add other parameters to the URL. For example, it is recommended that you add the useServerPrepStmts=true parameter to the database connection URL if you are using MySQL as your external database. This property improves the queryset/query validation if a column or table is missing. With this parameter in place, the MySQL driver reports a warning that the table or column doesn't exist.
How do I define datasources on the container level?
If you prefer to define your datasources on the container level, the recommended approach is to define the datasource in the container and then use a resource-ref in the Database Connector properties file to reference it..
Info |
---|
Using <Resource-ref> to define datasources is not supported if you are running the Database Connector in Standalone mode. Use <Resource-def> instead. |
...
- Edit <frevvo-home>\tomcat\conf\Catalina\localhost\context.xml.default,
Add the Resource name parameter. An example is shown below:
Code Block <Resource name="jdbc/<your database name>" auth="Container" driverClassName="com.mysql.jdbc.Driver" username="<your database user>" password="<your database password>" type="javax.sql.DataSource" url="jdbc:mysql://localhost/<your queryset name>?autoconnect=true"/>
Edit frevvo\tomcat\conf\frevvo-config.properties file. Verify that the frevvo.connectors.database.configuration property has been set and add the dbconnector.resource-ref.name property as shown below:
Code Block dbconnector.queryset@<queryset name>.resource-ref.name=jdbc/<name of your resource>
How do I Disable QuerySet/Query?
When you are developing your integration, you might want to disable a particular queryset/query so you can focus on the one you are troubleshooting. QuerySets/queries can be disabled in one of two ways:
Add the enabled= attribute with a value of false to the <querySet/> or individual <query> elements in the configuration.xml file to completely disable it.
Code Block <dbconnector> <querySet name="BIRT" enabled="false" ...>
The same can be done by adding the enabled property with a value of false as shown below to the dbconnector.properties(standalone bundle) or frevvo-config.properties (tomcat bundle).
Code Block dbconnector.querySet@<queryset name>.enabled=false
This property disables all querysets. Add it to the dbconnector.properties(standalone bundle) or frevvo-config.properties (tomcat bundle).
Code Block dbconnector.querySet.enabled=false
...