wood burning stoves 2.0*
The moose likes JDBC and the fly likes LIMIT in Hypersonic and MySQL. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "LIMIT in Hypersonic and MySQL." Watch "LIMIT in Hypersonic and MySQL." New topic
Author

LIMIT in Hypersonic and MySQL.

Chris Harris
Ranch Hand

Joined: Sep 21, 2003
Posts: 231
Hi,

I am currently looking at creating a database component that can be used with both Hypersonic and MYSQL. As I am required to execute large statments a need to use the limit SQL keyword.

I have notice a differance between Hypersonic and MySQL. In Hypersonic the syntax is:



However In MySQL the syntax for limit is:



So I can't send the same statements to both database.

I was wondering which one is the standard way for the LIMIT syntax.

Once I know the standard way this should be done I may start looking at the database code for the non-standard one. May even be able to make them both the same

Thanks

Chris.


SCJP 1.2, SCWCD, SCBCD
Srinivas Gogineni
Greenhorn

Joined: May 06, 2004
Posts: 6
hi,
Hypersonic SQL is "In memory database".So it may not statisfy all the sandard SQL notations.

Thx and regards
-Srini
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

curious argument
mySql doesn't have views and subqueries...

however - the postgresql looks a bit like mySql:


SQL isn't standardized that much, (a nuisance) - perhaps it's wise to look what the market-leader (oracle) is saying?
[ May 27, 2004: Message edited by: Stefan Wagner ]

http://home.arcor.de/hirnstrom/bewerbung
Albert Gan
Greenhorn

Joined: Aug 19, 2003
Posts: 15
As long as i can remembered, the limit syntaxes differ from 1 vendor to another, ex mysql uses keyword limit, oracle uses the rownum function, etc.

It's almost impossible to use standard ways in persistence layer. Perhaps you should code different classes for different database/any other legacy systems, and plug the correct ones to the business process tier. Data Access Object, Inversion of Control/Abstract Factory and Factory pattern could do some help.

good luck to you ^^
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: LIMIT in Hypersonic and MySQL.
 
Similar Threads
Query -- select maximum salary in a sum table
SQL question: returning the posts between rank y and z
Please Point Out My Mistakes
Display the sequence numbers on the output rows of a select in Oracle 10g
Help with SQL