Reputation: 654
In jdbc, how to check, that we are using oracle 8i database?
Upvotes: 3
Views: 844
Reputation: 308938
Connection connection = DriverManager.getConnection(url);
DatabaseMetaData meta = connection.getMetaData();
String product = meta.getDatabaseProductName();
String major = meta.getDatabaseMajorVersion();
String minor = meta.getDatabaseMinorVersion();
Upvotes: 6
Reputation: 19877
Run:
select * from v$version
It should produce something like:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
...
Then it's just a simple matter of parsing that 1st result row.
Upvotes: 2