Here you can find the source of getUnderlyingDriver(String url)
jdbc:ssh
type URL, find the underlying real driver that accepts the URL.
Parameter | Description |
---|---|
url | JDBC connection URL. |
Parameter | Description |
---|---|
SQLException | if a database access error occurs. |
jdbc:ssh
type URL or there is no underlying driver that accepts the URL.
private static Driver getUnderlyingDriver(String url) throws SQLException
//package com.java2s; //License from project: Apache License import java.sql.Driver; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Enumeration; public class Main { /**/*from w ww.j av a 2 s .c o m*/ * Given a <code>jdbc:ssh</code> type URL, find the underlying real driver * that accepts the URL. * * @param url * JDBC connection URL. * * @return Underlying driver for the given URL. Null is returned if the URL * is not a <code>jdbc:ssh</code> type URL or there is no underlying * driver that accepts the URL. * * @throws SQLException * if a database access error occurs. */ private static Driver getUnderlyingDriver(String url) throws SQLException { Enumeration e = DriverManager.getDrivers(); Driver d; while (e.hasMoreElements()) { d = (Driver) e.nextElement(); if (d.acceptsURL(url)) { return d; } } return null; } }