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

Quick Search    Search Deep

Source code: hsr/ipm/storing/DatabaseConnectionAttributes.java


1   package hsr.ipm.storing;
2   
3   /*
4         This program is free software; you can redistribute it and/or modify
5         it under the terms of the GNU General Public License as published by
6         the Free Software Foundation; either version 2 of the License, or
7         (at your option) any later version.
8   
9         This program is distributed in the hope that it will be useful,
10        but WITHOUT ANY WARRANTY; without even the implied warranty of
11        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12        GNU General Public License for more details.
13  
14        You should have received a copy of the GNU General Public License
15        along with this program; if not, write to the Free Software
16        Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18  
19  
20  /**
21   * Collects all different attributes needed to connect to a database and
22   * returns a connection URL string.
23   *
24   * @author Christian Niklaus
25   * @author Daniel Kamm
26   * @version 1.0
27   */
28  public class DatabaseConnectionAttributes {
29  
30    /**
31     * Protocol of atabase
32     */
33      public String protocol = new String("jdbc:mysql://");
34    /**
35     * Hostname of database
36     */
37      public String hostname = new String("localhost");
38    /**
39     * Name of database
40     */
41      public String database = new String();
42    /**
43     * Username of database
44     */
45      public String username = new String();
46    /**
47     * Password of database
48     */
49      public String password = new String();
50  
51    /**
52     * Returns the arranged string to connect to a database
53     * @return the arranged string to connect to a database
54     */
55      public String toString() {
56          StringBuffer out = new StringBuffer().append(protocol).append(hostname).append("/").append(database).append("?user=").append(username).append("&password=").append(password);
57          return out.toString();
58      }
59  
60  }