简体   繁体   English

从JDBC中的Oracle到Postgresql迁移的问题

[英]Oracle to Postgresql migration issue in JDBC

I want to make an application which is developed by another developer up and running. 我想制作一个由其他开发人员开发并运行的应用程序。 When I set up the environment I got sql exception said bad sql grammer. 当我设置环境时,出现sql异常,表示SQL语法错误。 I browsed through internet to get a solution for that. 我浏览了互联网以获取解决方案。 I found that the syntax is oracle native method. 我发现语法是oracle本机方法。 But I do not understand how it was working well in earlier days with postgresql. 但是我不明白在早期使用postgresql时它如何运作良好。

SELECT * FROM hrms.teammember b, hrms.designationmaster e WHERE  b.designationid = e.designation_id(+);

Thanks in advance for your help. 在此先感谢您的帮助。

Finally I figured it out. 终于我明白了。 The enterprisedb version advanced server with oracle compatibility software support these native oracle queries. 带有oracle兼容性软件的enterprisedb版本高级服务器支持这些本机oracle查询。

If you are migrating from one dialect to another, you have only two choices: 如果要从一种方言迁移到另一种方言,则只有两种选择:

  1. Modify the SQL 修改SQL
  2. Use an abstraction framework that can handle the modification on the fly 使用可以即时处理修改的抽象框架

Since you do not want to use Hibernate, you are left with finding another database abstraction framework. 由于您不想使用Hibernate,因此只剩下寻找另一个数据库抽象框架。 You might do your own search for "java database abstraction layer" and examine the results to see if one will work for you. 您可以自己搜索“ java数据库抽象层”,然后检查结果以查看是否适合您。

If you want to use Hibernate then you must migrate your application from direct JDBC use to Hibernate. 如果要使用Hibernate,则必须将应用程序从直接使用JDBC迁移到Hibernate。

If you have a DB layer specific to postgresql you have no choice but to migrate it , either to Oracle (might be simpler in the short term but won't help you must change the DB again) or to an ORM like Hibernate (may be a bit more complex but you gain compatibility with most DB vendors). 如果您有一个特定于Postgresql的数据库层,则别无选择,只能将其迁移到Oracle(短期内可能会更简单,但无济于事,您必须再次更改DB)或Hibernate之类的ORM(可能是稍微复杂一点,但是您可以与大多数数据库供应商兼容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM