Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
data-computing-proxy-test
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李振振
data-computing-proxy-test
Commits
a1fbeda8
Commit
a1fbeda8
authored
Jul 28, 2023
by
李振振
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1232
parent
cb3b0f8e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
28 deletions
+30
-28
src/main/java/com/beagle/informix/repository/impl/VccinfoDaoImpl.java
...a/com/beagle/informix/repository/impl/VccinfoDaoImpl.java
+3
-3
src/main/java/com/beagle/informix/service/impl/InformixHibernateServiceImpl.java
...e/informix/service/impl/InformixHibernateServiceImpl.java
+6
-5
src/main/java/com/beagle/informix/service/impl/InformixJdbcProxyServiceImpl.java
...e/informix/service/impl/InformixJdbcProxyServiceImpl.java
+15
-15
src/main/java/com/beagle/informix/service/impl/InformixMybatisServiceImpl.java
...gle/informix/service/impl/InformixMybatisServiceImpl.java
+3
-2
src/main/resources/application.yaml
src/main/resources/application.yaml
+1
-1
src/main/resources/init.sql
src/main/resources/init.sql
+2
-2
No files found.
src/main/java/com/beagle/informix/repository/impl/VccinfoDaoImpl.java
View file @
a1fbeda8
...
...
@@ -69,14 +69,14 @@ public class VccinfoDaoImpl implements VccinfoDao {
// 第二步:设置jpql的参数
Query
query
=
entityManager
.
createQuery
(
jpql
);
query
.
setParameter
(
1
,
"
赵六666999
"
);
query
.
setParameter
(
2
,
"%jpa%"
);
query
.
setParameter
(
1
,
"
222
"
);
query
.
setParameter
(
2
,
3
);
// 第三步:执行jpql
int
rows
=
query
.
executeUpdate
();
System
.
out
.
println
(
"影响的行数:"
+
rows
);
transaction
.
commit
();
//
transaction.commit();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
// transaction.rollback();
...
...
src/main/java/com/beagle/informix/service/impl/InformixHibernateServiceImpl.java
View file @
a1fbeda8
...
...
@@ -35,13 +35,14 @@ public class InformixHibernateServiceImpl implements InformixService {
@Override
@Transactional
public
void
doConnectJob
()
throws
Exception
{
insert
();
// update(
);
// query(
);
// delete(
);
insert
();
update
(
10
);
query
(
10
);
delete
(
10
);
}
private
void
insert
()
throws
Exception
{
Vccinfo
vccinfo
=
new
Vccinfo
();
// 主键生成策略如果声明了,这里不能再手动指定id
// vccinfo.setVId(23);
vccinfo
.
setEffective
(
1
);
vccinfo
.
setVName
(
"hibernate"
);
...
...
@@ -71,7 +72,7 @@ public class InformixHibernateServiceImpl implements InformixService {
List
<
Vccinfo
>
vccinfoList
=
vccinfoDao
.
getAllVccInfo
();
log
.
info
(
"queryAll:{}"
,
JSONUtil
.
toJsonStr
(
vccinfoDao
.
getAllVccInfo
()));
//
log.info("queryAll:{}",JSONUtil.toJsonStr(vccinfoDao.getAllVccInfo()));
log
.
info
(
"queryById:{}"
,
JSONUtil
.
toJsonStr
(
vccinfoDao
.
getVccInfoById
(
id
)));
}
private
void
delete
(
int
id
)
{
...
...
src/main/java/com/beagle/informix/service/impl/InformixJdbcProxyServiceImpl.java
View file @
a1fbeda8
...
...
@@ -45,9 +45,9 @@ public class InformixJdbcProxyServiceImpl implements InformixService {
Driver
driver
=
getDriver
();
Connection
conn
=
getConnection
(
driver
);
insert
(
conn
);
//
update(conn);
//
query(conn);
//
delete(conn);
update
(
conn
);
query
(
conn
);
delete
(
conn
);
closeConnection
(
conn
);
deregisterDriver
(
driver
);
}
...
...
@@ -66,23 +66,23 @@ public class InformixJdbcProxyServiceImpl implements InformixService {
// 创建testdb数据库、my_test_create_table表
// 现在模拟插入、更新、删除、查询等sql
// 插入
String
insertSql
=
"insert into cti_vccinfo_new (
vccid ,vccname, effective, agentmax,ivrmax,updatekey,tclob,tblob) values (?,
? , ?, ?, ? , ?,?,? )"
;
String
insertSql
=
"insert into cti_vccinfo_new (
vccname, effective, agentmax,ivrmax,updatekey,tclob,tblob) values (
? , ?, ?, ? , ?,?,? )"
;
PreparedStatement
stat
=
conn
.
prepareStatement
(
insertSql
);
stat
.
setObject
(
1
,
"123456"
);
stat
.
setObject
(
2
,
"vname"
);
stat
.
setObject
(
3
,
1
);
stat
.
setObject
(
4
,
2
);
stat
.
setObject
(
5
,
3
);
stat
.
setObject
(
6
,
"updatekey"
);
String
clobContent
=
"This is a very very long string"
;
//
stat.setObject(1, "123456");
stat
.
setObject
(
1
,
"vname"
);
stat
.
setObject
(
2
,
1
);
stat
.
setObject
(
3
,
2
);
stat
.
setObject
(
4
,
3
);
stat
.
setObject
(
5
,
"updatekey"
);
String
clobContent
=
"This is a very very long string
df sdferwerqwsdasdsda
"
;
// 处理clob字段
StringReader
reader
=
new
StringReader
(
clobContent
);
stat
.
setClob
(
7
,
reader
,
clobContent
.
length
());
stat
.
setClob
(
6
,
reader
,
clobContent
.
length
());
// 处理blob字段
Resource
resource
=
resourceLoader
.
getResource
(
"classpath:EnableLoopback.exe"
);
File
inputStream
=
resource
.
getFile
();
FileInputStream
fis
=
new
FileInputStream
(
inputStream
);
stat
.
setBlob
(
8
,
fis
);
stat
.
setBlob
(
7
,
fis
);
stat
.
executeUpdate
();
}
private
void
update
(
Connection
conn
)
throws
Exception
{
...
...
@@ -125,9 +125,9 @@ public class InformixJdbcProxyServiceImpl implements InformixService {
Properties
properties
=
new
Properties
();
// 组装连接数据库信息
// jdbc:informix-sqli://<server>:<port1526>/<database>:informixserver=<dbservername>
StringBuilder
jdbcBuilder
=
new
StringBuilder
(
"jdbc:mysql://localhost:3307"
)
StringBuilder
jdbcBuilder
=
new
StringBuilder
(
"jdbc:mysql://localhost:
2
3307"
)
.
append
(
"/"
)
.
append
(
"
testdb"
).
append
(
"?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai&useServerPrepStmts=true"
);
.
append
(
"
postgres"
).
append
(
"?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai&useServerPrepStmts=true"
);
// useServerPrepStmts=true
DriverManager
.
setLoginTimeout
(
10
);
properties
.
put
(
"user"
,
"root"
);
properties
.
put
(
"password"
,
"Apurelove9014"
);
...
...
src/main/java/com/beagle/informix/service/impl/InformixMybatisServiceImpl.java
View file @
a1fbeda8
...
...
@@ -42,7 +42,7 @@ public class InformixMybatisServiceImpl extends ServiceImpl<VccinfoMapper, Vccin
}
private
void
insertMethod
()
throws
Exception
{
Vccinfo
vccinfo
=
new
Vccinfo
();
vccinfo
.
setVId
(
3
);
vccinfo
.
setVId
(
22
);
vccinfo
.
setEffective
(
1
);
vccinfo
.
setVName
(
"mybatis"
);
vccinfo
.
setIvrMax
(
1
);
...
...
@@ -60,7 +60,8 @@ public class InformixMybatisServiceImpl extends ServiceImpl<VccinfoMapper, Vccin
// insert
// 如果使用实体保存,则需要在blob字段上新增BlobTypeHandler转换
// 如果使用xml的insert保存,也需要在属性上设置BlobTypeHandler转换
baseMapper
.
insertData
(
vccinfo
);
// baseMapper.insertData(vccinfo);
baseMapper
.
insert
(
vccinfo
);
}
private
void
updateMethod
()
throws
Exception
{
...
...
src/main/resources/application.yaml
View file @
a1fbeda8
...
...
@@ -4,7 +4,7 @@ spring:
# url: jdbc:informix-sqli://localhost:9088/testdb:INFORMIXSERVER=informix
#&useServerPrepStmts=true
# url: jdbc:mysql://localhost:3307/testdb?useUnicode=true&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai
url
:
jdbc:mysql://localhost:
3307/testdb
?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai
url
:
jdbc:mysql://localhost:
23307/postgres
?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai
# url: jdbc:mysql://localhost:3307/testdb?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai&useServerPrepStmts=true
username
:
root
# username: informix
...
...
src/main/resources/init.sql
View file @
a1fbeda8
...
...
@@ -7,8 +7,8 @@ create table cti_vccinfo_new
agentmax
INTEGER
default
0
not
null
,
ivrmax
INTEGER
default
0
not
null
,
updatekey
VARCHAR
(
30
),
tclob
clob
null
,
tblob
b
lob
null
,
tclob
text
null
,
tblob
b
ytea
null
,
primary
key
(
vccid
)
constraint
PK_CTI_VI_new
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment