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
-
Method Summary
Modifier and TypeMethodDescriptionint[]
int[]
protected Connection
Get ConnectionGet the CLOBs meta data - which is built while initialization.ForConnects
creating Meta data before Datasource is usable.static AnResultset
Use this for querying database without help of sql builder (which need query meta data first with this method).static String
truncatUtf8
(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 incorrectly
Probable 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
ForConnects
creating Meta data before Datasource is usable.- Specified by:
select
in classAbsConnect<CpConnect>
- Parameters:
sql
-- Returns:
- query results
- Throws:
SQLException
NamingException
-
commit
- Specified by:
commit
in classAbsConnect<CpConnect>
- Throws:
SQLException
NamingException
-
truncatUtf8
-
commit
public int[] commit(io.odysz.semantics.IUser log, ArrayList<String> sqls, ArrayList<Clob> lobs, int i) throws SQLException - Specified by:
commit
in classAbsConnect<CpConnect>
- Throws:
SQLException
-