[766] | 1 | /* |
---|
| 2 | Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. |
---|
| 3 | |
---|
| 4 | |
---|
| 5 | The MySQL Connector/J is licensed under the terms of the GPLv2 |
---|
| 6 | <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most MySQL Connectors. |
---|
| 7 | There are special exceptions to the terms and conditions of the GPLv2 as it is applied to |
---|
| 8 | this software, see the FLOSS License Exception |
---|
| 9 | <http://www.mysql.com/about/legal/licensing/foss-exception.html>. |
---|
| 10 | |
---|
| 11 | This program is free software; you can redistribute it and/or modify it under the terms |
---|
| 12 | of the GNU General Public License as published by the Free Software Foundation; version 2 |
---|
| 13 | of the License. |
---|
| 14 | |
---|
| 15 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
---|
| 16 | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
---|
| 17 | See the GNU General Public License for more details. |
---|
| 18 | |
---|
| 19 | You should have received a copy of the GNU General Public License along with this |
---|
| 20 | program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth |
---|
| 21 | Floor, Boston, MA 02110-1301 USA |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | |
---|
| 25 | */ |
---|
| 26 | package com.mysql.jdbc; |
---|
| 27 | |
---|
| 28 | import java.sql.SQLException; |
---|
| 29 | |
---|
| 30 | /** |
---|
| 31 | * The Java SQL framework allows for multiple database drivers. Each driver |
---|
| 32 | * should supply a class that implements the Driver interface |
---|
| 33 | * |
---|
| 34 | * <p> |
---|
| 35 | * The DriverManager will try to load as many drivers as it can find and then |
---|
| 36 | * for any given connection request, it will ask each driver in turn to try to |
---|
| 37 | * connect to the target URL. |
---|
| 38 | * |
---|
| 39 | * <p> |
---|
| 40 | * It is strongly recommended that each Driver class should be small and |
---|
| 41 | * standalone so that the Driver class can be loaded and queried without |
---|
| 42 | * bringing in vast quantities of supporting code. |
---|
| 43 | * |
---|
| 44 | * <p> |
---|
| 45 | * When a Driver class is loaded, it should create an instance of itself and |
---|
| 46 | * register it with the DriverManager. This means that a user can load and |
---|
| 47 | * register a driver by doing Class.forName("foo.bah.Driver") |
---|
| 48 | * |
---|
| 49 | * @see org.gjt.mm.mysql.Connection |
---|
| 50 | * @see java.sql.Driver |
---|
| 51 | * @author Mark Matthews |
---|
| 52 | * @version $Id$ |
---|
| 53 | */ |
---|
| 54 | public class Driver extends NonRegisteringDriver implements java.sql.Driver { |
---|
| 55 | // ~ Static fields/initializers |
---|
| 56 | // --------------------------------------------- |
---|
| 57 | |
---|
| 58 | // |
---|
| 59 | // Register ourselves with the DriverManager |
---|
| 60 | // |
---|
| 61 | static { |
---|
| 62 | try { |
---|
| 63 | java.sql.DriverManager.registerDriver(new Driver()); |
---|
| 64 | } catch (SQLException E) { |
---|
| 65 | throw new RuntimeException("Can't register driver!"); |
---|
| 66 | } |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | // ~ Constructors |
---|
| 70 | // ----------------------------------------------------------- |
---|
| 71 | |
---|
| 72 | /** |
---|
| 73 | * Construct a new driver and register it with DriverManager |
---|
| 74 | * |
---|
| 75 | * @throws SQLException |
---|
| 76 | * if a database error occurs. |
---|
| 77 | */ |
---|
| 78 | public Driver() throws SQLException { |
---|
| 79 | // Required for Class.forName().newInstance() |
---|
| 80 | } |
---|
| 81 | } |
---|