Mirth Connect & OIE Database Troubleshooting
Database connectivity is critical for Mirth Connect and Open Integration Engine (OIE) operations. Both platforms use the same JDBC-based database layer, so every solution in this guide applies equally whether you are running Mirth Connect or OIE.
This guide provides comprehensive, step-by-step solutions for common database connection issues across MySQL, SQL Server, Oracle, and PostgreSQL.
Quick Diagnosis
Section titled “Quick Diagnosis”Connection Test Checklist
Section titled “Connection Test Checklist”Before diving into database-specific issues, verify these basics:
- Network Connectivity — Can you ping the database server?
- Port Accessibility — Is the database port open and accessible?
- Credentials — Are username and password correct?
- Database Existence — Does the target database/schema exist?
- Permissions — Does the user have necessary privileges?
Common Error Patterns
Section titled “Common Error Patterns”| Error Pattern | Likely Cause |
|---|---|
Connection refused | Database server down or port blocked |
Login failed | Authentication issue |
Timeout | Network or performance issue |
Driver not found | JDBC driver missing or incorrect |
Communications link failure | MySQL server unreachable |
TNS:could not resolve | Oracle TNS misconfiguration |
MySQL Troubleshooting
Section titled “MySQL Troubleshooting”Communications Link Failure
Section titled “Communications Link Failure”Error Message:
com.mysql.cj.jdbc.exceptions.CommunicationsException:Communications link failureCauses and Solutions:
-
MySQL Server Down
Check and start MySQL service # Check MySQL statussudo systemctl status mysql# Start MySQL if stoppedsudo systemctl start mysql -
Network Issues
Test network connectivity to MySQL # Test connectivity to MySQL porttelnet mysql-server 3306# Check firewall rulessudo ufw status -
Connection Timeout
Increase MySQL timeout values -- Increase timeout valuesSET GLOBAL wait_timeout = 600;SET GLOBAL interactive_timeout = 600;
Access Denied Errors
Section titled “Access Denied Errors”Error Message:
java.sql.SQLException: Access denied for user 'username'@'host'Solutions:
-
Verify User Exists
Check if the MySQL user exists SELECT User, Host FROM mysql.user WHERE User = 'your_username'; -
Grant Proper Permissions
Grant permissions to the Mirth Connect database user GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'%';FLUSH PRIVILEGES;Security
Using
'%'as the host allows connections from any IP address. In production, restrict this to the specific IP or subnet of your Mirth Connect/OIE server. -
Check Host Restrictions
Create users with host restrictions -- Allow connections from any hostCREATE USER 'username'@'%' IDENTIFIED BY 'password';-- Or restrict to a specific hostCREATE USER 'username'@'192.168.1.100' IDENTIFIED BY 'password';
MySQL Connection Pool Settings
Section titled “MySQL Connection Pool Settings”# Recommended MySQL connection pool settings for Mirth Connect / OIEinitialPoolSize=5minPoolSize=5maxPoolSize=20acquireIncrement=1maxIdleTime=300MySQL Server Configuration
Section titled “MySQL Server Configuration”[mysqld]max_connections = 200wait_timeout = 600interactive_timeout = 600max_allowed_packet = 64MSQL Server Troubleshooting
Section titled “SQL Server Troubleshooting”Login Failed
Section titled “Login Failed”Error Message:
com.microsoft.sqlserver.jdbc.SQLServerException:Login failed for user 'username'Solutions:
-
Check Authentication Mode
Enable mixed mode authentication -- Enable mixed mode authenticationEXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE',N'Software\Microsoft\MSSQLServer\MSSQLServer',N'LoginMode', REG_DWORD, 2; -
Enable SQL Server Authentication
- Open SQL Server Management Studio
- Right-click server, select Properties, then Security
- Select “SQL Server and Windows Authentication mode”
-
Create or Modify User
Create SQL Server login and user for Mirth Connect -- Create loginCREATE LOGIN [username] WITH PASSWORD = 'password';-- Create user in databaseUSE [database_name];CREATE USER [username] FOR LOGIN [username];-- Grant permissionsALTER ROLE db_datareader ADD MEMBER [username];ALTER ROLE db_datawriter ADD MEMBER [username];Permissions
The
db_datareaderanddb_datawriterroles cover most Mirth Connect/OIE operations. For schema changes during upgrades, the user may also needdb_ddladmin.
Connection Timeout
Section titled “Connection Timeout”Error Message:
java.sql.SQLTimeoutException: The connection has timed outSolutions:
-
Increase Connection Timeout
JDBC connection string with timeout jdbc:sqlserver://server:1433;databaseName=mydb;loginTimeout=30; -
Check SQL Server Browser Service
Start SQL Server Browser service # Start SQL Server Browsernet start "SQL Server Browser" -
Verify Port Configuration
- Default port: 1433
- Check SQL Server Configuration Manager
- Ensure TCP/IP protocol is enabled
SQL Server Connection String Optimization
Section titled “SQL Server Connection String Optimization”jdbc:sqlserver://server:1433;databaseName=mydb;selectMethod=cursor;responseBuffering=adaptive;loginTimeout=30;socketTimeout=0;Oracle Troubleshooting
Section titled “Oracle Troubleshooting”TNS Resolution Error
Section titled “TNS Resolution Error”Error Message:
java.sql.SQLException: ORA-12154:TNS:could not resolve the connect identifier specifiedSolutions:
-
Check TNS Names File
$ORACLE_HOME/network/admin/tnsnames.ora MYDB =(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = oracle-server)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = ORCL))) -
Use Direct Connection String (bypass TNS)
Direct Oracle JDBC connection string jdbc:oracle:thin:@oracle-server:1521:ORCL -
Test with SQL*Plus
Test Oracle connection with SQL*Plus sqlplus username/password@oracle-server:1521/ORCL
Listener Not Running
Section titled “Listener Not Running”Error Message:
ORA-12541: TNS:no listenerSolutions:
-
Start Oracle Listener
Start and verify Oracle listener lsnrctl start -
Check Listener Status
Check Oracle listener status lsnrctl status -
Verify Listener Configuration
$ORACLE_HOME/network/admin/listener.ora LISTENER =(DESCRIPTION_LIST =(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = oracle-server)(PORT = 1521))))
Oracle Connection Pool Settings
Section titled “Oracle Connection Pool Settings”# Oracle-specific connection pool settings for Mirth Connect / OIEinitialPoolSize=3minPoolSize=3maxPoolSize=15acquireIncrement=1maxIdleTime=1800testConnectionOnCheckout=truepreferredTestQuery=SELECT 1 FROM DUALPostgreSQL Troubleshooting
Section titled “PostgreSQL Troubleshooting”Connection Refused
Section titled “Connection Refused”Error Message:
org.postgresql.util.PSQLException:Connection to localhost:5432 refusedSolutions:
-
Check PostgreSQL Status
Check and start PostgreSQL service sudo systemctl status postgresqlsudo systemctl start postgresql -
Verify Configuration
/etc/postgresql/13/main/postgresql.conf listen_addresses = '*'port = 5432Listen Address
By default, PostgreSQL only listens on
localhost. If your Mirth Connect or OIE server is on a different machine, you must changelisten_addressesto'*'or the specific network interface, then restart PostgreSQL. -
Update pg_hba.conf
/etc/postgresql/13/main/pg_hba.conf # Allow connections from the Mirth Connect / OIE server subnethost all all 0.0.0.0/0 md5Security
The
0.0.0.0/0CIDR allows connections from any IP. In production, restrict this to the specific IP or subnet of your Mirth Connect/OIE server (e.g.,192.168.1.0/24).
Authentication Failed
Section titled “Authentication Failed”Error Message:
org.postgresql.util.PSQLException:FATAL: password authentication failed for user "username"Solutions:
-
Create User
Create PostgreSQL user for Mirth Connect CREATE USER username WITH PASSWORD 'password';GRANT ALL PRIVILEGES ON DATABASE database_name TO username; -
Reset Password
Reset PostgreSQL user password ALTER USER username PASSWORD 'new_password';
General Database Best Practices
Section titled “General Database Best Practices”These practices apply to all database platforms when used with Mirth Connect or OIE.
Connection Pool Configuration
Section titled “Connection Pool Configuration”-
Size Appropriately
- Start with 5-10 connections per Mirth instance
- Monitor usage and adjust based on peak load
- Consider the total connection count across all instances
-
Set Timeouts
- Connection timeout: 30 seconds
- Query timeout: 60 seconds
- Idle timeout: 300 seconds
-
Enable Connection Testing
- Test connections on checkout to detect stale connections
- Use simple validation queries (
SELECT 1orSELECT 1 FROM DUALfor Oracle) - Handle failed connections gracefully with automatic retry
Monitoring and Maintenance
Section titled “Monitoring and Maintenance”-
Regular Health Checks
- Monitor connection pool metrics (active, idle, pending counts)
- Check database server status and availability
- Review error logs for connection warnings
-
Performance Monitoring
- Track query execution times — slow queries can bottleneck message processing
- Monitor connection usage patterns to right-size pool settings
- Identify and optimize slow queries with
EXPLAINplans
-
Preventive Maintenance
- Schedule regular database maintenance windows (index rebuilds, statistics updates)
- Optimize indexes on Mirth Connect message tables, especially
d_m*tables - Run statistics updates after large message volume changes
Getting Professional Help
Section titled “Getting Professional Help”When database issues persist or become complex, consider professional support:
- Saga IT Consulting — Expert Mirth Connect, OIE, and database integration support
- Database-Specific Support — Vendor support for your database platform (MySQL, SQL Server, Oracle, PostgreSQL)
- Community Resources — OIE GitHub Issues for open-source community help
Our team has resolved database connectivity issues for healthcare organizations running Mirth Connect and OIE on MySQL, SQL Server, Oracle, and PostgreSQL across AWS, Azure, and on-premise environments.
Contact Saga IT for database integration support | Mirth Connect services | OIE services