Reputation: 139
I am using MyBatis persistence framework to connect to Teradata. Tomcat 7 is the server used. On doing performance testing, when an insert query is fired through Mybatis connections are getting timed out. The issue occurs only on performance testing and the issue is only on write operation The exception I am getting is - Caused by: com.teradata.jdbc.jdbc_4.util.JDBCException: [Teradata JDBC Driver] [TeraJDBC 14.00.00.21] [Error 802] [SQLState HY000] Timeout occurred for Packet receive ...
I am using connection pooling in Tomcat using Resource declaration (and accessing it using JNDI). Listing below the server.xml entry
<Resource name="jdbc/ TERADATA " auth="Container"
type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
driverClassName="com.teradata.jdbc.TeraDriver"
url="jdbc:teradata:// <host name> /TMODE=TERA,LOB_SUPPORT=ON,DATABASE= <Schema Name>"
username="<User>" password="<password>"
maxActive="60"
maxIdle="10"
maxWait="200"
minIdle="2"
initialSize="2"
validationQuery="select 1"
testOnBorrow="TRUE"
removeAbandoned="TRUE"
removeAbandonedTimeout="60”
logAbandoned="FALSE" jdbcInterceptors="ConnectionState;ResetAbandonedTimer;SlowQueryReportJmx(threshold=30000)"
logValidationErrors="TRUE"
defaultAutoCommit="FALSE"
validationInterval="1000"
testOnReturn="FALSE”
minEvictableIdleTimeMillis="900000
timeBetweenEvictionRunsMillis="1800000"
autoReconnect="TRUE"
accessToUnderlyingConnectionAllowed=”TRUE"
/>
Is there any possibility that the connection pooling of tomcat conflicts with the one of Mybatis. If so is there any way to override it. In MyBatis a row level loacking is enabled. Will that create an issue of connections getting used up.
Upvotes: 1
Views: 3335
Reputation: 7786
Have you considered the Slow Logon issue that occurs with the Teradata JDBC driver when using the TD2 (default) authentication mechanism?
This issue has been attributed to a defect in the default random number generator that is used by the Java Virtual Machine. The link provides you with a test script to confirm the problem exists as well as a documented work around to address the defect.
EDIT:
This would address how your connections in Mybatis are handled with regards to POOLED or UNPOOLED. It would not address the JNDI configuration as that would have to be handled within JNDI.
<dataSource type="POOLED">
<property name="driver" value="${driver}"/>
<property name="url" value="${url}"/>
<property name="username" value="${username}"/>
<property name="password" value="${password}"/>
</dataSource>
<dataSource type="UNPOOLED">
<property name="driver" value="${driver}"/>
<property name="url" value="${url}"/>
<property name="username" value="${username}"/>
<property name="password" value="${password}"/>
</dataSource>
This method would likely require that the JDBC client is installed on your Mybatis server and may not work with your implementation depending on how your infrastructure has been designed.
Upvotes: 1