Overview
The Database Connector provides functionality to retrieve data from JDBC-compatible relational databases and register it in the Fess index.
This feature is built into Fess and requires no additional plugins.
Supported Databases
All JDBC-compatible databases are supported. Main examples:
MySQL / MariaDB
PostgreSQL
Oracle Database
Microsoft SQL Server
SQLite
H2 Database
Prerequisites
JDBC driver is required
Read access to the database is required
Proper query design is important when retrieving large amounts of data
Installing JDBC Drivers
Place the JDBC driver in the lib/ directory:
Restart Fess to load the driver.
Configuration
Configure in the admin console under “Crawler” -> “Data Store” -> “Create New”.
Basic Settings
| Item | Example |
|---|---|
| Name | Products Database |
| Handler Name | DatabaseDataStore |
| Enabled | On |
Parameter Configuration
MySQL/MariaDB example:
PostgreSQL example:
Parameter List
| Parameter | Required | Description |
|---|---|---|
driver | Yes | JDBC driver class name |
url | Yes | JDBC connection URL |
username | Yes | Database username |
password | Yes | Database password |
sql | Yes | SQL query for data retrieval |
fetch_size | No | Fetch size (default: 100) |
Script Configuration
Map SQL column names to index fields:
Available fields:
data.<column_name>- SQL query result columns
SQL Query Design
Efficient Queries
Query performance is important when handling large amounts of data:
Incremental Crawling
Methods to retrieve only updated records:
URL Generation
Generate document URLs in the script:
Multi-byte Character Support
When handling data with multi-byte characters such as Japanese:
MySQL
PostgreSQL
PostgreSQL uses UTF-8 by default. If needed:
Connection Pooling
Consider connection pooling when processing large amounts of data:
Security
Protecting Database Credentials
Warning
Writing passwords directly in configuration files poses a security risk.
Recommended methods:
Use environment variables
Use Fess encryption features
Use read-only users
Principle of Least Privilege
Grant only minimum necessary permissions to database users:
Usage Examples
Product Catalog Search
Parameters:
Script:
Knowledge Base Articles
Parameters:
Script:
Troubleshooting
JDBC Driver Not Found
Symptom: ClassNotFoundException or No suitable driver
Resolution:
Verify that JDBC driver is placed in
lib/Verify driver class name is correct
Restart Fess
Connection Errors
Symptom: Connection refused or authentication errors
Check:
Is the database running?
Is the hostname and port correct?
Is the username and password correct?
Firewall settings
Query Errors
Symptom: SQLException or SQL syntax errors
Check:
Test the SQL query directly on the database
Verify column names are correct
Verify table names are correct
Reference Information
Data Store Connector Overview - Data Store Connector Overview
CSV Connector - CSV Connector
JSON Connector - JSON Connector
Data Store Crawling - Data Store Configuration Guide