Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JDBC and Relational Databases
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Jeanne Boyarsky
Ron McLeod
Sheriffs:
Paul Clapham
Liutauras Vilda
Devaka Cooray
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
JDBC and Relational Databases
JDBC - How to find Oracle Driver Version
Hari Krishna Varma Gadiraju
Greenhorn
Posts: 3
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Is there way what oracle driver version my
java
code is using?
I would like to know if my code is using the oracle8i / 9i
JDBC
Driver.
Balazs Borbely
Ranch Hand
Posts: 33
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
look into the driver jar file
in META-INF\MANIFEST.MF
'Make everything as simple as possible, but not simpler.' --Albert Einstein
stu derby
Ranch Hand
Posts: 333
posted 18 years ago
1
Number of slices to send:
Optional 'thank-you' note:
Send
The DatabaseMetaData class will tell you.
import java.sql.*; public class dbinfo { public static void main (String arr[]) throws Exception { String dbDriver="oracle.jdbc.driver.OracleDriver"; String dbURL = "jdbc:oracle:thin:@test-db:1521:testsid"; String dbPW = "my_password"; String dbUser = "my_username"; Connection con = null; Class.forName(dbDriver); con = DriverManager.getConnection (dbURL, dbUser, dbPW); con.setAutoCommit(false); DatabaseMetaData dbmd = con.getMetaData(); System.out.println("===== Database info ====="); System.out.println("DatabaseProductName: " + dbmd.getDatabaseProductName() ); System.out.println("DatabaseProductVersion: " + dbmd.getDatabaseProductVersion() ); System.out.println("DatabaseMajorVersion: " + dbmd.getDatabaseMajorVersion() ); System.out.println("DatabaseMinorVersion: " + dbmd.getDatabaseMinorVersion() ); System.out.println("===== Driver info ====="); System.out.println("DriverName: " + dbmd.getDriverName() ); System.out.println("DriverVersion: " + dbmd.getDriverVersion() ); System.out.println("DriverMajorVersion: " + dbmd.getDriverMajorVersion() ); System.out.println("DriverMinorVersion: " + dbmd.getDriverMinorVersion() ); System.out.println("===== JDBC/DB attributes ====="); System.out.print("Supports getGeneratedKeys(): "); if (dbmd.supportsGetGeneratedKeys() ) System.out.println("true"); else System.out.println("false"); pstmt.close(); con.close(); } }
[ March 24, 2006: Message edited by: stu derby ]
My first bit of advice is that if you are going to be a mime, you shouldn't talk. Even the tiny ad is nodding:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Hibernate Oracle BuildSessionFactory initial Error
Unable to Insert these Chinese Character
Unsupported feature
setAutocommit
Web Application Class Loader and Weblogic
More...