GitHub user mjs0514 created a discussion: Raising an issue regarding 
VGroupMappingDataBaseDAO.java on the seata server

In oracle db, cluster is identified as a reserved word.

```
// script/server/db/oracle.sql
CREATE TABLE vgroup_table
(
    vGroup    VARCHAR2(255) PRIMARY KEY,
    namespace VARCHAR2(255),
    cluster   VARCHAR2(255)
);
```
So when I run the oracle.sql script in the oracle environment, it fails.


```
// 
server/src/main/java/org/apache/seata/server/storage/db/store/VGroupMappingDataBaseDAO.java
public boolean insertMappingDO(MappingDO mappingDO) {
        String sql = "INSERT INTO " + vMapping + " (vgroup,namespace, cluster) 
VALUES (?, ?, ?)";
        Connection conn = null;
        PreparedStatement ps = null;
        try {
            int index = 1;
            conn = vGroupMappingDataSource.getConnection();
            conn.setAutoCommit(true);
            ps = conn.prepareStatement(sql);
            ps.setString(index++, mappingDO.getVGroup());
            ps.setString(index++, mappingDO.getNamespace());
            ps.setString(index++, mappingDO.getCluster());

            return ps.executeUpdate() > 0;
        } catch (SQLException e) {
            throw new SeataRuntimeException(ErrorCode.ERR_CONFIG, e);
        } finally {
            IOUtil.close(ps, conn);
        }
    }
...
```

Therefore, it is expected that the insertMappingDO method of 
VGroupMappingDataBaseDAO will fail to execute the query when executed in an 
Oracle environment.

deleteMappingDOByVGroup, queryMappingDO also appear similar.

I think it would be better to change the cluster column to a keyword other than 
a reserved word. What do you think?

I find it odd that these queries only cause problems with Oracle, while they 
work fine with other database vendors.

However, I believe that using double quotes to avoid reserved word issues could 
potentially affect other database vendors, even if it doesn't cause problems 
with Oracle.

Please give me your opinion. Thank you.

GitHub link: https://github.com/apache/incubator-seata/discussions/7798

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to