Package io.odysz.semantic.DA.cp
Class CpConnect
Pooled connection manager.
- Author:
- Ody
-
Field Summary
Fields inherited from class io.odysz.semantic.DA.AbsConnect
drvName, enableSystemout, flag_disableSql, flag_nothing, flag_printSql, id, locks, log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint[]int[]protected ConnectionGet ConnectionGet the CLOBs meta data - which is built while initialization.ForConnectscreating Meta data before Datasource is usable.static AnResultsetUse this for querying database without help of sql builder (which need query meta data first with this method).static StringtruncatUtf8(String s, int maxBytes) Methods inherited from class io.odysz.semantic.DA.AbsConnect
close, commit, driverType, getAutoseqLock, initDmConnect, initPooledConnect, printSql, printSql, prop, prop
-
Constructor Details
-
Method Details
-
select
Use this for querying database without help of sql builder (which need query meta data first with this method).- Parameters:
src- name that matches context.xml/Resource/name, like 'inet' etc.sql-- Returns:
- results
- Throws:
SQLException
-
getlobMeta
Get the CLOBs meta data - which is built while initialization.- Returns:
- map[tabl, [field, lob]]
-
getConnection
Get ConnectionIssue with Mysql 8.0.2:
For mysql 8.0.0, the SSL connection is enabled by default. And got SSL connection exception:javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake Caused by: java.io.EOFException: SSL peer shut down incorrectlyProbable caused by no certificate?
To solve this temporarily, for pooled connect, in server.xml (tomcat), set connectionProperties="useSSL=false",<Resource auth="Container" connectionProperties="useUnicode=yes;characterEncoding=utf8;autoReconnect=true;autoReconnectForPools=true;useSSL=false;enabledTLSProtocols=TLSv1,TLSv1.1,TLSv1.2" driverClassName="com.mysql.cj.jdbc.Driver" maxActive="10" maxIdle="3" maxWait="10000" global="jdbc/db-name" name="jdbc/db-name" password="..." type="javax.sql.DataSource" url="jdbc:mysql://host:3306/db-name" username="..."/>See This.- Returns:
- connection
- Throws:
SQLException- database access error occurs while get connection. SeeDataSource.getConnection().NamingException- lookup connection failed
-
select
ForConnectscreating Meta data before Datasource is usable.- Specified by:
selectin classAbsConnect<CpConnect>- Parameters:
sql-- Returns:
- query results
- Throws:
SQLExceptionNamingException
-
commit
- Specified by:
commitin classAbsConnect<CpConnect>- Throws:
SQLExceptionNamingException
-
truncatUtf8
-
commit
public int[] commit(io.odysz.semantics.IUser log, ArrayList<String> sqls, ArrayList<Clob> lobs, int i) throws SQLException - Specified by:
commitin classAbsConnect<CpConnect>- Throws:
SQLException
-