01: /*
02: Copyright (C) 2002-2004 MySQL AB
03:
04: This program is free software; you can redistribute it and/or modify
05: it under the terms of version 2 of the GNU General Public License as
06: published by the Free Software Foundation.
07:
08: There are special exceptions to the terms and conditions of the GPL
09: as it is applied to this software. View the full text of the
10: exception in file EXCEPTIONS-CONNECTOR-J in the directory of this
11: software distribution.
12:
13: This program is distributed in the hope that it will be useful,
14: but WITHOUT ANY WARRANTY; without even the implied warranty of
15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16: GNU General Public License for more details.
17:
18: You should have received a copy of the GNU General Public License
19: along with this program; if not, write to the Free Software
20: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21:
22:
23:
24: */
25: package com.mysql.jdbc;
26:
27: import java.sql.SQLException;
28:
29: /**
30: * The Java SQL framework allows for multiple database drivers. Each driver
31: * should supply a class that implements the Driver interface
32: *
33: * <p>
34: * The DriverManager will try to load as many drivers as it can find and then
35: * for any given connection request, it will ask each driver in turn to try to
36: * connect to the target URL.
37: *
38: * <p>
39: * It is strongly recommended that each Driver class should be small and
40: * standalone so that the Driver class can be loaded and queried without
41: * bringing in vast quantities of supporting code.
42: *
43: * <p>
44: * When a Driver class is loaded, it should create an instance of itself and
45: * register it with the DriverManager. This means that a user can load and
46: * register a driver by doing Class.forName("foo.bah.Driver")
47: *
48: * @see org.gjt.mm.mysql.Connection
49: * @see java.sql.Driver
50: * @author Mark Matthews
51: * @version $Id: Driver.java 3726 2005-05-19 15:52:24Z mmatthews $
52: */
53: public class Driver extends NonRegisteringDriver implements
54: 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: }
|