Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

where to check JDBC driver version? 1

Status
Not open for further replies.

huchen

Programmer
Jan 24, 2006
68
US
Hello,
Somebody asked me this:
What version of JDBC driver do we use to connect to the database?

Where should I look to find out the answer?

Database is Oracle and application is on BEA server(web application)

The more detailed your answer is, the better it will help me.

Thank you.
 
Thank you.
I used following to get the JDBC driver on my local.



import java.sql.*;
import oracle.jdbc.driver.*;

class JDBCVersion
{
public static void main (String args [])
throws SQLException
{
// Load the Oracle JDBC driver

DriverManager.registerDriver
(new oracle.jdbc.driver.OracleDriver());

// Change the following code line to reflect a valid connection to your

// server

Connection conn = DriverManager.getConnection
("jdbc:eek:racle:thin:myDBservre:port#:sid","scott","tiger");

// Create Oracle DatabaseMetaData object
DatabaseMetaData meta = conn.getMetaData ();

// gets driver info:

System.out.println("\n=============\nDatabase Product Name is ... " +
meta.getDatabaseProductName());
System.out.println("\nDatabase Product Version is " +
meta.getDatabaseProductVersion());
System.out.println("\n=============\nJDBC Driver Name is ........ " +
meta.getDriverName());
System.out.println("\nJDBC Driver Version is ..... " +
meta.getDriverVersion());
System.out.println("\nJDBC Driver Major Version is " +
meta.getDriverMajorVersion());
System.out.println("\nJDBC Driver Minor Version is " +
meta.getDriverMinorVersion());
System.out.println("\n=============");
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top