Is there any method in java using which we can find which database we are using....let me elaborate.. I am writing a java code which will query a database.. there are two databases..SQL server and Oracle ....and I have two different SQL statement for these...I have to decide from the program which database I am using and use the appropriate SQL statement in the program... So is there any system call to do this? Thanks
The two queries you've highlighted are identical in all but one respect - how you've chosen to handle the dates. If you rewrote the query to use a PreparedStatement and bind the date value as a Date object then you can use this on both DBs transparently.
If you find yourself worrying about the effect of DB specific SQL finding its way into your application then I suggest you read up on the DAO pattern.