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

polardbx的curd测试

parent cb3b0f8e
......@@ -69,14 +69,13 @@ public class VccinfoDaoImpl implements VccinfoDao {
// 第二步:设置jpql的参数
Query query = entityManager.createQuery(jpql);
query.setParameter(1, "赵六666999");
query.setParameter(2, "%jpa%");
query.setParameter(1, vccinfo.getVName());
query.setParameter(2, vccinfo.getVId());
// 第三步:执行jpql
int rows = query.executeUpdate();
System.out.println("影响的行数:" + rows);
transaction.commit();
// transaction.commit();
} catch (Exception e) {
e.printStackTrace();
// transaction.rollback();
......
......@@ -35,10 +35,10 @@ public class InformixHibernateServiceImpl implements InformixService {
@Override
@Transactional
public void doConnectJob() throws Exception{
insert();
// update();
// query();
// delete();
// insert();
update(123458);
query(123458);
delete(123458);
}
private void insert() throws Exception{
Vccinfo vccinfo = new Vccinfo();
......
......@@ -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);
}
......@@ -125,7 +125,7 @@ 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:13309")
.append("/")
.append("testdb").append("?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai&useServerPrepStmts=true");
DriverManager.setLoginTimeout(10);
......
......@@ -35,14 +35,14 @@ public class InformixMybatisServiceImpl extends ServiceImpl<VccinfoMapper, Vccin
@Override
@Transactional
public void doConnectJob() throws Exception{
insertMethod();
// updateMethod();
// queryMethod();
// delete();
// insertMethod();
updateMethod();
queryMethod();
delete();
}
private void insertMethod() throws Exception{
Vccinfo vccinfo = new Vccinfo();
vccinfo.setVId(3);
// vccinfo.setVId(3);
vccinfo.setEffective(1);
vccinfo.setVName("mybatis");
vccinfo.setIvrMax(1);
......@@ -65,19 +65,19 @@ public class InformixMybatisServiceImpl extends ServiceImpl<VccinfoMapper, Vccin
private void updateMethod() throws Exception {
LambdaQueryWrapper<Vccinfo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Vccinfo::getVId, "ibatis");
queryWrapper.eq(Vccinfo::getVId, "123459");
Vccinfo vccinfo = new Vccinfo();
vccinfo.setVName("mybatis-update");
baseMapper.update(vccinfo, queryWrapper);
}
private void queryMethod() {
List<Vccinfo> vccinfoList = vccinfoMapper.queryList(1);
List<Vccinfo> vccinfoList = vccinfoMapper.queryList(123459);
log.info("queryAll:{}", JSONUtil.toJsonStr(vccinfoList));
}
private void delete() {
LambdaQueryWrapper<Vccinfo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Vccinfo::getVId, "ibatis");
queryWrapper.eq(Vccinfo::getVId, "123459");
baseMapper.delete(queryWrapper);
}
......
......@@ -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: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
username: root
# username: informix
......@@ -26,7 +26,7 @@ spring:
jpa:
properties:
hibernate:
dialect: org.hibernate.dialect.InformixDialect
dialect: org.hibernate.dialect.MySQLDialect
format_sql: true
mybatis-plus:
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