search

Home  >  Q&A  >  body text

mysql - How to make the sql of the java project compatible with the sql syntax of multiple databases?

How can the sql statements in Java projects be compatible with multiple databases? The project belongs to the product category and it is not confirmed which database the user uses. We use db2 during development, but if we encounter an oracle database, sql will fail. I don't know how to achieve compatibility with multiple databases. For example, oracle, MySQL, SQL server, db2, etc.

PHPzPHPz2749 days ago952

reply all(2)I'll reply

  • 阿神

    阿神2017-05-18 10:47:51

    You can try using an ORM framework that supports multiple dialects.

    reply
    0
  • 大家讲道理

    大家讲道理2017-05-18 10:47:51

    Isn’t ORM the solution to this problem? It executes different sql, jpa, hibernate according to the configured database dialect

    reply
    0
  • Cancelreply