Coder Social home page Coder Social logo

Comments (3)

yedf2 avatar yedf2 commented on June 2, 2024

表结构是对的呢?哪里不对,帮忙指出

from dtmcli-java-sample.

theNebuchadnezzar avatar theNebuchadnezzar commented on June 2, 2024

首先在本地库执行了 https://github.com/dtm-labs/dtm/blob/main/sqls/busi.mysql.sql 这段sql

然后java sample里

1.application.yml 文件使用的库名:

  datasource:
    url: jdbc:mysql://localhost:3306/dtm_barrier?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=UTC

把‘dtm_barrier’改为‘dtm_busi’了

2.代码 TransBarrierController.java : 169 中使用的SQL语句:

            String sql = "update dtm_busi.user_account set trading_balance=trading_balance-?,balance=balance+? where user_id=?";

运行 DtmcliJavaSampleApplication.java ,执行 curl localhost:8081/api/tccBarrier 有报错

2022-04-18 14:47:23.109  INFO 5216 --- [nio-8081-exec-4] c.d.j.s.c.TransBarrierController         : barrierTransOutCancel branchBarrier:BranchBarrier(transType=tcc, gid=Kuc8HRtDR9Q4oQHUkV5JxD, branchId=01, op=cancel, barrierId=0)
2022-04-18 14:47:23.134  WARN 5216 --- [nio-8081-exec-4] barrier.BranchBarrier                    : barrier call error

java.sql.SQLSyntaxErrorException: Table 'dtm_busi.barrier' doesn't exist
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120) ~[mysql-connector-java-8.0.26.jar:8.0.26]
	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) ~[mysql-connector-java-8.0.26.jar:8.0.26]

java demo代码里用到的表,在sql文件里名字没对上

from dtmcli-java-sample.

theNebuchadnezzar avatar theNebuchadnezzar commented on June 2, 2024

又找到一段建 barrier 表的sql,https://github.com/dtm-labs/dtm/blob/main/sqls/dtmcli.barrier.mysql.sql

执行完代码能用了

建议在readme加上说明以及两个sql的链接

from dtmcli-java-sample.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.