数据操作,如何选择自定义数据库
Delia499 发布于86月前 1答/1763阅

我想实现的功能:在定时任务中从一个表抽取两个字段插入到新的表中


过程中遇到的问题:

//定时器中的代码

protected void process(JobExecutionContext context) {

String sql = "insert into wlk.abcc(org_id, mobile) select c.org_id as org_id , c.mobile as mobile 

from wlk.t_user_contact c ";

Db.update(sql);

}

//这里wlk是我自定义的数据库  错误提示是: Table 'wlk.abcc' doesn't exist


String sql = "insert into abcc(org_id, mobile) select c.org_id as org_id , c.mobile as mobile 

from t_user_contact c ";

//将数据库去掉直接写表名    错误提示是 : Table 'demo.abcc' doesn't exist


我的分析过程如下:表abcc 在自定义数据库 wlk 中,为啥会报错?? 自己也想不明白





[沙发] Delia499
看了源码设置的默认数据库,然后将jdbc 配置文件的main 参数改成了自己的数据库地址就oK啦
亮点
提交评论
嘿,我来帮你!