Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/mysql/jdbc/Driver.java


1   /*
2    Copyright (C) 2002-2004 MySQL AB
3   
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of version 2 of the GNU General Public License as
6    published by the Free Software Foundation.
7    
8   
9    There are special exceptions to the terms and conditions of the GPL 
10   as it is applied to this software. View the full text of the 
11   exception exception in file EXCEPTIONS-CONNECTOR-J in the directory of this 
12   software distribution.
13  
14   This program is distributed in the hope that it will be useful,
15   but WITHOUT ANY WARRANTY; without even the implied warranty of
16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   GNU General Public License for more details.
18  
19   You should have received a copy of the GNU General Public License
20   along with this program; if not, write to the Free Software
21   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  
23   */
24  package com.mysql.jdbc;
25  
26  /**
27   * The Java SQL framework allows for multiple database drivers.  Each
28   * driver should supply a class that implements the Driver interface
29   *
30   * <p>The DriverManager will try to load as many drivers as it can find and
31   * then for any given connection request, it will ask each driver in turn
32   * to try to connect to the target URL.
33   *
34   * <p>It is strongly recommended that each Driver class should be small and
35   * standalone so that the Driver class can be loaded and queried without
36   * bringing in vast quantities of supporting code.
37   *
38   * <p>When a Driver class is loaded, it should create an instance of itself
39   * and register it with the DriverManager.  This means that a user can load
40   * and register a driver by doing Class.forName("foo.bah.Driver")
41   *
42   * @see org.gjt.mm.mysql.Connection
43   * @see java.sql.Driver
44   * @author Mark Matthews
45   * @version $Id: Driver.java,v 1.20.2.8 2004/08/09 22:15:11 mmatthew Exp $
46   */
47  public class Driver extends NonRegisteringDriver {
48    
49  
50      //
51      // Register ourselves with the DriverManager
52      //
53      static {
54          try {
55              java.sql.DriverManager.registerDriver(new Driver());
56          } catch (java.sql.SQLException E) {
57              throw new RuntimeException("Can't register driver!");
58          }
59  
60          if (DEBUG) {
61              Debug.trace("ALL");
62          }
63      }
64  
65      /**
66       * Construct a new driver and register it with DriverManager
67       *
68       * @throws java.sql.SQLException if a database error occurs.
69       */
70      public Driver() throws java.sql.SQLException {
71          // Required for Class.forName().newInstance()
72      }
73  }