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

Quick Search    Search Deep

Source code: openfuture/util/database/MySqlServer.java


1   package openfuture.util.database;
2   import java.sql.SQLException;
3   import java.sql.Driver;
4   import java.sql.DriverManager;
5   /*
6    * This library is free software; you can redistribute it and/or
7    * modify it under the terms of the GNU Lesser General Public
8    * License as published by the Free Software Foundation; either
9    * version 2 of the License, or (at your option) any later version.<p>
10   *
11   * This library is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14   * Lesser General Public License for more details.<p>
15   *
16   * You should have received a copy of the GNU Lesser General Public
17   * License along with this library; if not, write to the Free Software
18   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA<br>
19   * http://www.gnu.org/copyleft/lesser.html
20   */
21  
22  // Configuration Management Information: 
23  // -------------------------------------
24  // $Id: MySqlServer.java,v 1.3 2001/07/01 06:46:30 wreissen Exp $
25  //
26  // Version History:
27  // ----------------
28  // $Log: MySqlServer.java,v $
29  // Revision 1.3  2001/07/01 06:46:30  wreissen
30  // fixed errors in DOS/Unix-translation.
31  //
32  // Revision 1.1  2001/03/23 06:25:34  wreissen
33  // initial version
34  //
35  //
36  // ***********************************************************************************
37  /**
38   * MySqlServer.java
39   *
40   *
41   * Created: Tue Mar 13 06:34:20 2001
42   *
43   * @author <a href="mailto:wolfgang@openfuture.de">Wolfgang Reissenberger</a>
44   * @version $Revision: 1.3 $
45   */
46  
47  public class MySqlServer extends DBServer {
48      
49      public MySqlServer() {
50    
51      }
52      public MySqlServer(String url) {
53    this();
54    init(url);
55      }
56      
57  
58      public void init(String url) {
59    super.init("jdbc:mysql:" + url);
60      }
61      
62  
63      /**
64       * Check, if a driver is already registered. If not, register
65       * the HypersonicSQL driver
66       *
67       * @exception SQLException if an error occurs
68       */
69      protected void checkDriver() throws SQLException {
70    // driver registered?
71    if (getDriver() == null) {
72        try {
73      setDriver((Driver) Class.forName("org.gjt.mm.mysql.Driver").newInstance());
74      DriverManager.registerDriver(getDriver());
75        } catch (InstantiationException e){
76      e.printStackTrace();
77        } catch (IllegalAccessException e){
78      e.printStackTrace();
79        } catch (ClassNotFoundException e){
80      e.printStackTrace();
81        }
82    }
83      }
84  
85      
86  } // MySqlServer