Commit bb6e6f78 authored by 李振振's avatar 李振振

polardbx的curd测试

parent cb3b0f8e
...@@ -69,14 +69,13 @@ public class VccinfoDaoImpl implements VccinfoDao { ...@@ -69,14 +69,13 @@ public class VccinfoDaoImpl implements VccinfoDao {
// 第二步:设置jpql的参数 // 第二步:设置jpql的参数
Query query = entityManager.createQuery(jpql); Query query = entityManager.createQuery(jpql);
query.setParameter(1, "赵六666999"); query.setParameter(1, vccinfo.getVName());
query.setParameter(2, "%jpa%"); query.setParameter(2, vccinfo.getVId());
// 第三步:执行jpql // 第三步:执行jpql
int rows = query.executeUpdate(); int rows = query.executeUpdate();
System.out.println("影响的行数:" + rows); System.out.println("影响的行数:" + rows);
// transaction.commit();
transaction.commit();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
// transaction.rollback(); // transaction.rollback();
......
...@@ -35,10 +35,10 @@ public class InformixHibernateServiceImpl implements InformixService { ...@@ -35,10 +35,10 @@ public class InformixHibernateServiceImpl implements InformixService {
@Override @Override
@Transactional @Transactional
public void doConnectJob() throws Exception{ public void doConnectJob() throws Exception{
insert(); // insert();
// update(); update(123458);
// query(); query(123458);
// delete(); delete(123458);
} }
private void insert() throws Exception{ private void insert() throws Exception{
Vccinfo vccinfo = new Vccinfo(); Vccinfo vccinfo = new Vccinfo();
......
...@@ -45,9 +45,9 @@ public class InformixJdbcProxyServiceImpl implements InformixService { ...@@ -45,9 +45,9 @@ public class InformixJdbcProxyServiceImpl implements InformixService {
Driver driver = getDriver(); Driver driver = getDriver();
Connection conn = getConnection(driver); Connection conn = getConnection(driver);
insert(conn); insert(conn);
// update(conn); update(conn);
// query(conn); query(conn);
// delete(conn); delete(conn);
closeConnection(conn); closeConnection(conn);
deregisterDriver(driver); deregisterDriver(driver);
} }
...@@ -125,7 +125,7 @@ public class InformixJdbcProxyServiceImpl implements InformixService { ...@@ -125,7 +125,7 @@ public class InformixJdbcProxyServiceImpl implements InformixService {
Properties properties = new Properties(); Properties properties = new Properties();
// 组装连接数据库信息 // 组装连接数据库信息
// jdbc:informix-sqli://<server>:<port1526>/<database>:informixserver=<dbservername> // jdbc:informix-sqli://<server>:<port1526>/<database>:informixserver=<dbservername>
StringBuilder jdbcBuilder = new StringBuilder("jdbc:mysql://localhost:3307") StringBuilder jdbcBuilder = new StringBuilder("jdbc:mysql://localhost:13309")
.append("/") .append("/")
.append("testdb").append("?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai&useServerPrepStmts=true"); .append("testdb").append("?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai&useServerPrepStmts=true");
DriverManager.setLoginTimeout(10); DriverManager.setLoginTimeout(10);
......
...@@ -35,14 +35,14 @@ public class InformixMybatisServiceImpl extends ServiceImpl<VccinfoMapper, Vccin ...@@ -35,14 +35,14 @@ public class InformixMybatisServiceImpl extends ServiceImpl<VccinfoMapper, Vccin
@Override @Override
@Transactional @Transactional
public void doConnectJob() throws Exception{ public void doConnectJob() throws Exception{
insertMethod(); // insertMethod();
// updateMethod(); updateMethod();
// queryMethod(); queryMethod();
// delete(); delete();
} }
private void insertMethod() throws Exception{ private void insertMethod() throws Exception{
Vccinfo vccinfo = new Vccinfo(); Vccinfo vccinfo = new Vccinfo();
vccinfo.setVId(3); // vccinfo.setVId(3);
vccinfo.setEffective(1); vccinfo.setEffective(1);
vccinfo.setVName("mybatis"); vccinfo.setVName("mybatis");
vccinfo.setIvrMax(1); vccinfo.setIvrMax(1);
...@@ -65,19 +65,19 @@ public class InformixMybatisServiceImpl extends ServiceImpl<VccinfoMapper, Vccin ...@@ -65,19 +65,19 @@ public class InformixMybatisServiceImpl extends ServiceImpl<VccinfoMapper, Vccin
private void updateMethod() throws Exception { private void updateMethod() throws Exception {
LambdaQueryWrapper<Vccinfo> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Vccinfo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Vccinfo::getVId, "ibatis"); queryWrapper.eq(Vccinfo::getVId, "123459");
Vccinfo vccinfo = new Vccinfo(); Vccinfo vccinfo = new Vccinfo();
vccinfo.setVName("mybatis-update"); vccinfo.setVName("mybatis-update");
baseMapper.update(vccinfo, queryWrapper); baseMapper.update(vccinfo, queryWrapper);
} }
private void queryMethod() { private void queryMethod() {
List<Vccinfo> vccinfoList = vccinfoMapper.queryList(1); List<Vccinfo> vccinfoList = vccinfoMapper.queryList(123459);
log.info("queryAll:{}", JSONUtil.toJsonStr(vccinfoList)); log.info("queryAll:{}", JSONUtil.toJsonStr(vccinfoList));
} }
private void delete() { private void delete() {
LambdaQueryWrapper<Vccinfo> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Vccinfo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Vccinfo::getVId, "ibatis"); queryWrapper.eq(Vccinfo::getVId, "123459");
baseMapper.delete(queryWrapper); baseMapper.delete(queryWrapper);
} }
......
...@@ -4,7 +4,7 @@ spring: ...@@ -4,7 +4,7 @@ spring:
# url: jdbc:informix-sqli://localhost:9088/testdb:INFORMIXSERVER=informix # url: jdbc:informix-sqli://localhost:9088/testdb:INFORMIXSERVER=informix
#&useServerPrepStmts=true #&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&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:13309/testdb?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 # url: jdbc:mysql://localhost:3307/testdb?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai&useServerPrepStmts=true
username: root username: root
# username: informix # username: informix
...@@ -26,7 +26,7 @@ spring: ...@@ -26,7 +26,7 @@ spring:
jpa: jpa:
properties: properties:
hibernate: hibernate:
dialect: org.hibernate.dialect.InformixDialect dialect: org.hibernate.dialect.MySQLDialect
format_sql: true format_sql: true
mybatis-plus: mybatis-plus:
configuration: configuration:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment