How to get all Loaded JDBC Driver List in Java?

Below Code shows, how to get all loaded JDBC Driver list in java code –

/****************************************************************************************
 * Created on 05-2011 Copyright(c) http://kodehelp.com All Rights Reserved.
 ****************************************************************************************/
package com.kodehelp.javasql;

import java.sql.Driver;
import java.sql.DriverManager;
import java.util.Collections;
import java.util.List;

/**
 * Created by http://kodehelp.com
 * Date: 5/1/11
 */
public class GetLoadedDriverList {
    public static void main(String[] args){
        List drivers = Collections.list(DriverManager.getDrivers());
        for (Object driver1 : drivers) {
            Driver driver = (Driver) driver1;
            System.out.println(driver.getClass().getName());
            System.out.println(driver.getMajorVersion());
            System.out.println(driver.getMinorVersion());
            System.out.println(driver.jdbcCompliant());
        }
    }
}

Please Post Your Comments & Reviews

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.