I tried node-jt400 (Transactions)

Transactions Start journaling the physical file before running the test.

STRJRNPF FILE(MYLIB/MEMBER MYLIB/MEMBER2) JRN(MYLIB/JRN) IMAGES(*BOTH)

SQLtransactions.js


//Example of being committed
app.get("/tranCommit", function (req, res, next) {
    pool.transaction(function (tran) {
        var Id = 110;
        return tran.update("insert into member (ID,LNAME,FNAME,PROF,TOKUTEN) VALUES(?,?,?,?,?)", 
        [Id, "Tokugawa","Ietsuna",'4th generation', 4]).then(function () {
            return tran.update("insert into member2 (ID,LNAME,FNAME,PROF,TENSU) VALUES(?,?,?,?,?)", 
            [Id, "Tokugawa","Ietsuna",'4th generation', 4]); 
        });
    });
    res.send('end');
});

//An example of being rolled back. member2.Set characters in TENSU
app.get("/tranRollback", function (req, res, next) {
    pool.transaction(function (tran) {
        var Id = 111;
        return tran.update("insert into member (ID,LNAME,FNAME,PROF,TOKUTEN) VALUES(?,?,?,?,?)", 
        [Id, "Tokugawa","Tsunayoshi",'5th generation', 5]).then(function () {
            return tran.update("insert into member2 (ID,LNAME,FNAME,PROF,TENSU) VALUES(?,?,?,?,?)", 
            [Id, "Tokugawa","Tsunayoshi",'5th generation', 'a']); 
        });
    });
    res.send('end');
});

Running / tranCommit will correctly add records to each physical file. When I ran / tranRollback, an error occurred in the insert statement for member2 and no records were added to member.

Recommended Posts

I tried node-jt400 (Transactions)
I tried node-jt400 (Programs)
I tried node-jt400 (execute)
I tried node-jt400 (Environment construction)
I tried node-jt400 (IFS write)
I tried node-jt400 (SQL Update)
I tried node-jt400 (SQL stream)
I tried node-jt400 (IFS read)
I tried Spring.
I tried tomcat
I tried youtubeDataApi.
I tried refactoring ①
I tried JHipster 5.1
[I tried] Spring tutorial
I tried running Autoware
I tried using Gson
I tried QUARKUS immediately
I tried using TestNG
I tried Spring Batch
I tried using Galasa
I tried using azure cloud-init
I tried Spring State machine
I tried Drools (Java, InputStream)
I tried Rails beginner [Chapter 1]
I tried using Apache Wicket
I tried the VueJS tutorial!
I tried using Java REPL
I tried source code analysis
I tried the FizzBuzz problem
I tried putting XcodeGen + SwiftPM
I tried Rails beginner [Chapter 2]
I tried UPSERT with PostgreSQL.
I tried BIND with Docker
I tried to verify yum-cron
I tried Jets (ruby serverless)
I tried metaprogramming in Java
I tried using anakia + Jing now
I tried Angular tutorial + SpringBoot + PostgreSQL
I tried to chew C # (indexer)
I tried using JOOQ with Gradle
[K8s] I tried communication between pods!
I tried morphological analysis with MeCab
I tried a little digdag docker.run_options
I tried to summarize iOS 14 support
I tried to interact with Java
I tried UDP communication with Java
I tried putting Domino11 in CentOS7
I tried the Java framework "Quarkus"
[Rails] I tried deleting the application
I tried using Java8 Stream API
I tried Java's micro-benchmark tool JMH
I tried GraphQL with Spring Boot
I tried to summarize Java learning (1)
I tried to understand nil guard
I tried installing CentOS 8 on ESXi 6.7
I tried Flyway with Spring Boot
I tried using WebAssembly Stadio (2018/4/17 version)
I tried to summarize Java 8 now
I tried to chew C # (polymorphism: polymorphism)
I tried using Java memo LocalDate
I tried to explain Active Hash