Hello team,
We are making a POC for webMethods Integration Server CI/CD, so everything is based on docker.
When try to connect to SQL Server via WmJDBCAdapter(I tried both SQL Server 2019 and SQL Server 2022)
The console throws the following error:
```
jvm 1 | ,errorCode=204,errorMessageArgs=[0]com.microsoft.sqlserver.jdbc.SQLServerDataSource,[1]
jvm 1 | (08S01/0) The TCP/IP connection to the host host.docker.internal, port 1443 has failed. Error: "Connection refused. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".,errorResourceBundleName=com.wm.adapter.wmjdbc.JDBCAdapterResourceBundle,detail=null<<<,stack=com.wm.adk.error.AdapterConnectionException: [ADA.1.204] Cannot connect to the database with DataSource class "com.microsoft.sqlserver.jdbc.SQLServerDataSource".
jvm 1 | The TCP/IP connection to the host host.docker.internal, port 1443 has failed. Error: "Connection refused. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".
jvm 1 | at com.wm.adk.WmAdapter.createAdapterConnectionException(WmAdapter.java:276)
jvm 1 | at com.wm.adapter.wmjdbc.connection.ConnectionInfo.handleSQLException(ConnectionInfo.java:782)
jvm 1 | at com.wm.adapter.wmjdbc.connection.ConnectionInfo.handleSQLException(ConnectionInfo.java:793)
jvm 1 | at com.wm.adapter.wmjdbc.connection.JDBCConnection.initializeConnection(JDBCConnection.java:397)
```
I installed nc(netcat) in the container, it can connect to host.docker.internal:1433
Also as a developer, I tried to copy the some java JDBC code to run within webMethods docker container directly, it also can connect to SQL Server.
Based on this experiment, I assume there shouldn't be any network issue here.
```sh
# Test on my macOS, pass
$ javac Test.java
$ tree -L 1
.
├── mssql-jdbc-12.4.2.jre11.jar
├── Test.class
├── Test.java
$ java -cp .:mssql-jdbc-12.4.2.jre11.jar Test
Connecting to SQL Server...
Creating statement...
ID: 1, Email: james.smith@example.com
ID: 2, Email: emily.johnson@example.com
ID: 3, Email: michael.w@example.com
ID: 4, Email: sarah.brown@example.com
ID: 5, Email: david.jones@example.com
Connection closed.
# Copy to webMethods docker container
docker cp Test.class webMethods:/tmp/
docker exec -it webMethods bash
cd /tmp/
# Test Pass
/opt/softwareag/jvm/jvm/bin/java -cp .:/opt/softwareag/IntegrationServer/instances/default/packages/WmJDBCAdapter/code/jars/static/mssql-jdbc-12.4.2.jre11.jar Test
Connecting to SQL Server...
Creating statement...
ID: 1, Email: james.smith@example.com
ID: 2, Email: emily.johnson@example.com
ID: 3, Email: michael.w@example.com
ID: 4, Email: sarah.brown@example.com
ID: 5, Email: david.jones@example.com
Connection closed.
```
Here is my docker file
```dockerfile
FROM ibmwebmethods.azurecr.io/webmethods-integrationserver:10.15
ADD --chown=sagadmin:sagadmin WmJDBCAdapter /opt/softwareag/IntegrationServer/instances/default/packages/WmJDBCAdapter
ADD --chown=sagadmin:sagadmin mssql-jdbc-12.4.2.jre11.jar /opt/softwareag/IntegrationServer/instances/default/packages/WmJDBCAdapter/code/jars/static/
ADD --chown=sagadmin:sagadmin mysql-connector-j-8.3.0.jar /opt/softwareag/IntegrationServer/instances/default/packages/WmJDBCAdapter/code/jars/static/
```
I tried to connect with MySQL 8.0 via WmJDBCAdapter, it worked,
Here is the configuration page for MySQL (worked) ✅

Here is the configuration page for SQL Server 2019/2022, (not work) ❌

JDBC code inside webMethods IS container works ✅
```java
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class Test {
public static void main(String[] args) {
String jdbcUrl = "jdbc:sqlserver://host.docker.internal:1433;databaseName=night_elf;encrypt=true;trustServerCertificate=true";
String username = "sa";
String password = "ThisisS0me_password";
Connection connection = null;
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
System.out.println("Connecting to SQL Server...");
connection = DriverManager.getConnection(jdbcUrl, username, password);
System.out.println("Creating statement...");
Statement statement = connection.createStatement();
String sql = "SELECT TOP 5 * FROM CUSTOMERS";
ResultSet resultSet = statement.executeQuery(sql);
while (resultSet.next()) {
int id = resultSet.getInt("customer_id");
String email = resultSet.getString("email");
System.out.println("ID: " + id + ", Email: " + email);
}
resultSet.close();
statement.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (connection != null) {
connection.close();
System.out.println("Connection closed.");
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
```
Finally, this is my docker-compose file for SQL Server.
```yml
version: '3.8'
services:
sqlserver:
image: mcr.microsoft.com/mssql/server:2022-latest
container_name: sqlserver
environment:
ACCEPT_EULA: "Y"
MSSQL_SA_PASSWORD: "ThisisS0me_password"
ports:
- "1433:1433"
volumes:
- sqlserverdata:/var/opt/mssql
volumes:
sqlserverdata:
```
I searched in the forum, there is one question related to SQL Server: https://tech.forums.softwareag.com/t/sqlserver-jdbc-connection-failed/287759/11 however, the final solution is that they changed from SQL Server to Oracle, that is not what we want.
1. Do we have any working SQL Server example via docker?
2. Another questions is where to get the WmJDBCAdapter, I checked some posts from the forum, it suggests that we should apply for a Software AG Empower Account, I submitted the form during the weekends, they haven't approved yet. I guess they don't care about webMethods any longer, so from 2025 onwards, where can we get WmJDBCAdapter?