How to configure Oracle's Database Network Encryption with MyBatis

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to configure Oracle's Database Network Encryption with MyBatis

Chris Pratt

I have a requirement to Encrypt the data in transit between the web server and the database server.


The database server is Oracle 12c Enterprise Edition Release 12.1.0.2.0 - 64bit.  I am using  the ojdbc7.jar driver.


I am able to establish an encrypted connection as described here... https://docs.oracle.com/database/121/DBSEG/asojbdc.htm#DBSEG9613.  However, I have not been able to do so through MyBatis.  I am setting the connection properties in the mybatis-config.xml file.  Below are the content of that file:


<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE configuration PUBLIC '-//mybatis.org//DTD Config 3.0//EN' 'http://mybatis.org/dtd/mybatis-3-config.dtd'>

<configuration>
    <settings>
        <setting name="lazyLoadingEnabled" value="false" />
        <setting name="jdbcTypeForNull" value="NULL"/>
    </settings>
    <environments default="development">     
        <environment id="development">
            <transactionManager type="JDBC" />
            <dataSource type="POOLED">
                <property name="driver" value="oracle.jdbc.OracleDriver"/>
                <property name="url" value="jdbc:oracle:thin:@//<server>:<port>/<service>"/>
                <property name="username" value="<username>"/>
                <property name="password" value="<password>"/>
                <property name="poolMaximumActiveConnections" value="20"/>
                <property name="poolMaximumIdleConnections" value="10"/>
                <property name="poolMaximumCheckoutTime" value="180000"/>
                <property name="poolPingQuery" value="select 0 from dual"/>
                <property name="poolPingEnabled" value="true"/>
                <property name="poolPingConnectionsNotUsedFor" value="1800000"/>
                <property name="oracle.net.encryption_client" value="REQUIRED"/>
                <property name="oracle.net.encryption_types_client" value="(AES256)"/>
            </dataSource>
        </environment>
    </environments>
</configuration>


The last two property elements are my attempt at configuring an encrypted connection.  Without them I am able to connect successfully without encryption.  With the last two property elements I just get an error:


Caused by: org.apache.ibatis.exceptions.PersistenceException: ### Error building SqlSession. ### The error may exist in SQL Mapper Configuration ### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.datasource.DataSourceException: Unknown DataSource property: oracle.net.encryption_types_client


Does anybody know how to solve this?


Thanks.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to configure Oracle's Database Network Encryption with MyBatis

Jeff Butler
Prefix driver specific properties with "driver.".

Jeff Butler


On Thu, May 11, 2017 at 11:35 AM Chris Pratt <[hidden email]> wrote:

I have a requirement to Encrypt the data in transit between the web server and the database server.


The database server is Oracle 12c Enterprise Edition Release 12.1.0.2.0 - 64bit.  I am using  the ojdbc7.jar driver.


I am able to establish an encrypted connection as described here... https://docs.oracle.com/database/121/DBSEG/asojbdc.htm#DBSEG9613.  However, I have not been able to do so through MyBatis.  I am setting the connection properties in the mybatis-config.xml file.  Below are the content of that file:


<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE configuration PUBLIC '-//mybatis.org//DTD Config 3.0//EN' 'http://mybatis.org/dtd/mybatis-3-config.dtd'>

<configuration>
    <settings>
        <setting name="lazyLoadingEnabled" value="false" />
        <setting name="jdbcTypeForNull" value="NULL"/>
    </settings>
    <environments default="development">     
        <environment id="development">
            <transactionManager type="JDBC" />
            <dataSource type="POOLED">
                <property name="driver" value="oracle.jdbc.OracleDriver"/>
                <property name="url" value="jdbc:oracle:thin:@//<server>:<port>/<service>"/>
                <property name="username" value="<username>"/>
                <property name="password" value="<password>"/>
                <property name="poolMaximumActiveConnections" value="20"/>
                <property name="poolMaximumIdleConnections" value="10"/>
                <property name="poolMaximumCheckoutTime" value="180000"/>
                <property name="poolPingQuery" value="select 0 from dual"/>
                <property name="poolPingEnabled" value="true"/>
                <property name="poolPingConnectionsNotUsedFor" value="1800000"/>
                <property name="oracle.net.encryption_client" value="REQUIRED"/>
                <property name="oracle.net.encryption_types_client" value="(AES256)"/>
            </dataSource>
        </environment>
    </environments>
</configuration>


The last two property elements are my attempt at configuring an encrypted connection.  Without them I am able to connect successfully without encryption.  With the last two property elements I just get an error:


Caused by: org.apache.ibatis.exceptions.PersistenceException: ### Error building SqlSession. ### The error may exist in SQL Mapper Configuration ### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.datasource.DataSourceException: Unknown DataSource property: oracle.net.encryption_types_client


Does anybody know how to solve this?


Thanks.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to configure Oracle's Database Network Encryption with MyBatis

Chris Pratt
Jeff,
that worked!  Thanks so much for the help.

On Thursday, May 11, 2017 at 10:17:22 AM UTC-6, Jeff Butler wrote:
Prefix driver specific properties with "driver.".

Jeff Butler


On Thu, May 11, 2017 at 11:35 AM Chris Pratt <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="ZagWSj8FBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">chris...@...> wrote:

I have a requirement to Encrypt the data in transit between the web server and the database server.


The database server is Oracle 12c Enterprise Edition Release 12.1.0.2.0 - 64bit.  I am using  the ojdbc7.jar driver.


I am able to establish an encrypted connection as described here... <a href="https://docs.oracle.com/database/121/DBSEG/asojbdc.htm#DBSEG9613" rel="nofollow" style="color:rgb(0,89,153)" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fdocs.oracle.com%2Fdatabase%2F121%2FDBSEG%2Fasojbdc.htm%23DBSEG9613\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFeo_jngNYJnR4URdzb3asqbrVBYQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fdocs.oracle.com%2Fdatabase%2F121%2FDBSEG%2Fasojbdc.htm%23DBSEG9613\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFeo_jngNYJnR4URdzb3asqbrVBYQ&#39;;return true;">https://docs.oracle.com/database/121/DBSEG/asojbdc.htm#DBSEG9613.  However, I have not been able to do so through MyBatis.  I am setting the connection properties in the mybatis-config.xml file.  Below are the content of that file:


<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE configuration PUBLIC '-//<a href="http://mybatis.org//DTD" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmybatis.org%2F%2FDTD\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHjp-E8UL0TmmS7A0V54yMfbtfEkA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmybatis.org%2F%2FDTD\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHjp-E8UL0TmmS7A0V54yMfbtfEkA&#39;;return true;">mybatis.org//DTD Config 3.0//EN' '<a href="http://mybatis.org/dtd/mybatis-3-config.dtd" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmybatis.org%2Fdtd%2Fmybatis-3-config.dtd\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGXB2nr-n0oSNiBjt2LERCrM4XWKQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmybatis.org%2Fdtd%2Fmybatis-3-config.dtd\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGXB2nr-n0oSNiBjt2LERCrM4XWKQ&#39;;return true;">http://mybatis.org/dtd/mybatis-3-config.dtd'>

<configuration>
    <settings>
        <setting name="lazyLoadingEnabled" value="false" />
        <setting name="jdbcTypeForNull" value="NULL"/>
    </settings>
    <environments default="development">     
        <environment id="development">
            <transactionManager type="JDBC" />
            <dataSource type="POOLED">
                <property name="driver" value="oracle.jdbc.OracleDriver"/>
                <property name="url" value="jdbc:oracle:thin:@//<server>:<port>/<service>"/>
                <property name="username" value="<username>"/>
                <property name="password" value="<password>"/>
                <property name="poolMaximumActiveConnections" value="20"/>
                <property name="poolMaximumIdleConnections" value="10"/>
                <property name="poolMaximumCheckoutTime" value="180000"/>
                <property name="poolPingQuery" value="select 0 from dual"/>
                <property name="poolPingEnabled" value="true"/>
                <property name="poolPingConnectionsNotUsedFor" value="1800000"/>
                <property name="oracle.net.encryption_client" value="REQUIRED"/>
                <property name="oracle.net.encryption_types_client" value="(AES256)"/>
            </dataSource>
        </environment>
    </environments>
</configuration>


The last two property elements are my attempt at configuring an encrypted connection.  Without them I am able to connect successfully without encryption.  With the last two property elements I just get an error:


Caused by: org.apache.ibatis.exceptions.PersistenceException: ### Error building SqlSession. ### The error may exist in SQL Mapper Configuration ### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.datasource.DataSourceException: Unknown DataSource property: oracle.net.encryption_types_client


Does anybody know how to solve this?


Thanks.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="ZagWSj8FBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">mybatis-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.