diff -r 8f142472270c -r 701ec4db43fb java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/Driver.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/Driver.java Fri Apr 04 23:40:28 2014 +0200 @@ -0,0 +1,79 @@ +/** + * SQL-DK + * Copyright © 2014 František Kučera (frantovo.cz) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package info.globalcode.jdbc.loopback; + +import java.sql.DriverManager; +import java.sql.DriverPropertyInfo; +import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; +import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * + * @author Ing. František Kučera (frantovo.cz) + */ +public class Driver implements java.sql.Driver { + + private static final Logger log = Logger.getLogger(Driver.class.getName()); + + static { + try { + DriverManager.registerDriver(new Driver()); + } catch (SQLException e) { + log.log(Level.SEVERE, "Unable to register JDBC driver", e); + } + } + + @Override + public Connection connect(String url, Properties info) throws SQLException { + return new Connection(url, info); + } + + @Override + public boolean acceptsURL(String url) throws SQLException { + return url != null && url.startsWith("jdbc:loopback://"); + } + + @Override + public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException { + return new DriverPropertyInfo[0]; + } + + @Override + public int getMajorVersion() { + return 0; + } + + @Override + public int getMinorVersion() { + return 1; + } + + @Override + public boolean jdbcCompliant() { + return false; + } + + @Override + public Logger getParentLogger() throws SQLFeatureNotSupportedException { + throw new SQLFeatureNotSupportedException("Not supported yet."); + } + +}