0

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. I browsed through internet to get a solution for that. I found that the syntax is oracle native method. But I do not understand how it was working well in earlier days with postgresql.

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

Thanks in advance for your help.

2
  • 1
    The outer join syntax using (+) should not be used in Oracle either. Time to adopt modern explicit JOIN syntax Commented Sep 12, 2013 at 10:42
  • But the application has the syntax in many places. Should I edit all the sql queries. Is there any other solution? Commented Sep 12, 2013 at 11:15

3 Answers 3

2

Finally I figured it out. The enterprisedb version advanced server with oracle compatibility software support these native oracle queries.

Sign up to request clarification or add additional context in comments.

2 Comments

You should still change the queries to use the proper syntax.
Thanks for your advice, I understand that the query mentioned above is not ANSI standard. But I want to reduce the development time to make the application to production.
1

If you are migrating from one dialect to another, you have only two choices:

  1. Modify the 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. You might do your own search for "java database abstraction layer" and examine the results to see if one will work for you.

5 Comments

My application already uses JDBCtemplate provided by spring. That is why I can not use hibernate with that. But still my problem persist. Is there an abstraction framework which acts as next/intermediate layer to JDBCtemplate?
At this point I think it is your responsibility to research the available abstraction frameworks and decide if one works for you. If not you will have to write your own or modify the SQL.
Actually, my real problem is, I have a code developed by another developer. They use postgresql as db engine. But when I am trying to set up the application in my localhost, I am getting the error "bad grammer" I found that it was because of (+) symbol instead of joins in oracle queries. Now I want to run that application. Is there any postgre version support oracle native syntax?
Unfortunately no. There are enough differences that you will have to modify the SQL or write your own adapter layer. However, since Oracle supports the modern join syntax the queries should remain compatible with both unless you use Postgres-specific features.
Hey Jim, Postgre plus advanced server version supports this query.
0

If you want to use Hibernate then you must migrate your application from direct JDBC use to 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).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.