How to get all Loaded JDBC Driver List in Java?

DeeKay May 2, 2011 at 2:17 am · java.sql

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());
        }
    }
}