API Gateway: Unable to create JDBC connection with additional properties via Restman
search cancel

API Gateway: Unable to create JDBC connection with additional properties via Restman

book

Article ID: 199926

calendar_today

Updated On:

Products

CA API Gateway API SECURITY STARTER PACK-7

Issue/Introduction

When adding additional properties to the JDBC URL, the Restman POST call fails:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
            <l7:JDBCConnection xmlns:l7="http://ns.l7tech.com/2010/04/gateway-management">
                <l7:Name>localhost</l7:Name>
                <l7:Enabled>true</l7:Enabled>
                <l7:Properties>
                    <l7:Property key="maximumPoolSize">
                        <l7:IntegerValue>15</l7:IntegerValue>
                    </l7:Property>
                    <l7:Property key="minimumPoolSize">
                        <l7:IntegerValue>3</l7:IntegerValue>
                    </l7:Property>
                </l7:Properties>
                <l7:Extension>
                    <l7:DriverClass>com.l7tech.jdbc.mysql.MySQLDriver</l7:DriverClass>
                    <l7:JdbcUrl>jdbc:mysql://HOST123:3306/ssg?&useSSL=true&verifyServerCertificate=false</l7:JdbcUrl>
                    <l7:ConnectionProperties>
                        <l7:Property key="EnableCancelTimeout">
                            <l7:StringValue>true</l7:StringValue>
                        </l7:Property>
                        <l7:Property key="user">
                            <l7:StringValue>database_username</l7:StringValue>
                        </l7:Property>
                        <l7:Property key="password">
                            <l7:StringValue>${secpass.jdbc_password.plaintext}</l7:StringValue>
                        </l7:Property>
                    </l7:ConnectionProperties>
                </l7:Extension>
            </l7:JDBCConnection>

Environment

API Gateway: 10.0

Cause

It's a syntax issue. Ampersands are special characters in XML so we need to use the HTML version.

Resolution

Create a JDBC connection after making the highlighted changes:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
            <l7:JDBCConnection xmlns:l7="http://ns.l7tech.com/2010/04/gateway-management">
                <l7:Name>localhost</l7:Name>
                <l7:Enabled>true</l7:Enabled>
                <l7:Properties>
                    <l7:Property key="maximumPoolSize">
                        <l7:IntegerValue>15</l7:IntegerValue>
                    </l7:Property>
                    <l7:Property key="minimumPoolSize">
                        <l7:IntegerValue>3</l7:IntegerValue>
                    </l7:Property>
                </l7:Properties>
                <l7:Extension>
                    <l7:DriverClass>com.l7tech.jdbc.mysql.MySQLDriver</l7:DriverClass>
                    <l7:JdbcUrl>jdbc:mysql://HOST123:3306/ssg?&amp;useSSL=true&amp;verifyServerCertificate=false</l7:JdbcUrl>
                    <l7:ConnectionProperties>
                        <l7:Property key="EnableCancelTimeout">
                            <l7:StringValue>true</l7:StringValue>
                        </l7:Property>
                        <l7:Property key="user">
                            <l7:StringValue>database_username</l7:StringValue>
                        </l7:Property>
                        <l7:Property key="password">
                            <l7:StringValue>${secpass.jdbc_password.plaintext}</l7:StringValue>
                        </l7:Property>
                    </l7:ConnectionProperties>
                </l7:Extension>
            </l7:JDBCConnection>