Driver version
In this chapter you will learn:
Find out the driver version
import java.sql.Driver;
import java.sql.DriverManager;
import java.util.Collections;
import java.util.List;
/*from ja v a2 s .c om*/
public class Main {
public static void main(String[] argv) throws Exception {
List drivers = Collections.list(DriverManager.getDrivers());
for (int i = 0; i < drivers.size(); i++) {
Driver driver = (Driver) drivers.get(i);
String name = driver.getClass().getName();
System.out.println(name);
int majorVersion = driver.getMajorVersion();
System.out.println("MajorVersion:"+majorVersion);
int minorVersion = driver.getMinorVersion();
System.out.println("MinorVersion:"+minorVersion);
boolean isJdbcCompliant = driver.jdbcCompliant();
System.out.println("isJdbcCompliant:"+isJdbcCompliant);
}
}
}
The code above generates the following result.
Next chapter...
What you will learn in the next chapter:
Home » Java Tutorial » Driver and Connection