sidslog
sidslog

Reputation: 654

How to check, that we are using oracle 8i database in jdbc?

In jdbc, how to check, that we are using oracle 8i database?

Upvotes: 3

Views: 844

Answers (3)

Jai
Jai

Reputation: 3609

You might have to use the Database metadata class.

Upvotes: 5

duffymo
duffymo

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

Tom Tresansky
Tom Tresansky

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

Related Questions