Source code: org/hsqldb/util/ConnectionDialogCommon.java
1 /* Copyrights and Licenses
2 *
3 * This product includes Hypersonic SQL.
4 * Originally developed by Thomas Mueller and the Hypersonic SQL Group.
5 *
6 * Copyright (c) 1995-2000 by the Hypersonic SQL Group. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without modification, are permitted
8 * provided that the following conditions are met:
9 * - Redistributions of source code must retain the above copyright notice, this list of conditions
10 * and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright notice, this list of
12 * conditions and the following disclaimer in the documentation and/or other materials
13 * provided with the distribution.
14 * - All advertising materials mentioning features or use of this software must display the
15 * following acknowledgment: "This product includes Hypersonic SQL."
16 * - Products derived from this software may not be called "Hypersonic SQL" nor may
17 * "Hypersonic SQL" appear in their names without prior written permission of the
18 * Hypersonic SQL Group.
19 * - Redistributions of any form whatsoever must retain the following acknowledgment: "This
20 * product includes Hypersonic SQL."
21 * This software is provided "as is" and any expressed or implied warranties, including, but
22 * not limited to, the implied warranties of merchantability and fitness for a particular purpose are
23 * disclaimed. In no event shall the Hypersonic SQL Group or its contributors be liable for any
24 * direct, indirect, incidental, special, exemplary, or consequential damages (including, but
25 * not limited to, procurement of substitute goods or services; loss of use, data, or profits;
26 * or business interruption). However caused any on any theory of liability, whether in contract,
27 * strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this
28 * software, even if advised of the possibility of such damage.
29 * This software consists of voluntary contributions made by many individuals on behalf of the
30 * Hypersonic SQL Group.
31 *
32 *
33 * For work added by the HSQL Development Group:
34 *
35 * Copyright (c) 2001-2002, The HSQL Development Group
36 * All rights reserved.
37 *
38 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions are met:
40 *
41 * Redistributions of source code must retain the above copyright notice, this
42 * list of conditions and the following disclaimer, including earlier
43 * license statements (above) and comply with all above license conditions.
44 *
45 * Redistributions in binary form must reproduce the above copyright notice,
46 * this list of conditions and the following disclaimer in the documentation
47 * and/or other materials provided with the distribution, including earlier
48 * license statements (above) and comply with all above license conditions.
49 *
50 * Neither the name of the HSQL Development Group nor the names of its
51 * contributors may be used to endorse or promote products derived from this
52 * software without specific prior written permission.
53 *
54 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
55 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
56 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
57 * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG,
58 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
59 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
60 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
61 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
62 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
63 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
64 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
65 */
66
67
68 package org.hsqldb.util;
69
70 import java.util.Vector;
71
72 // sqlbob@users 20020407 - patch 1.7.0 - reengineering
73
74 /**
75 * Common code in the Swing and AWT versions of ConnectionDialog
76 * @version 1.7.0
77 */
78 class ConnectionDialogCommon {
79
80 private static String connTypes[][];
81 private final static String sJDBCTypes[][] = {
82 {
83 "HSQL Database Engine In-Memory", "org.hsqldb.jdbcDriver",
84 "jdbc:hsqldb:."
85 }, {
86 "HSQL Database Engine Standalone", "org.hsqldb.jdbcDriver",
87 "jdbc:hsqldb:\u00ABdatabase?\u00BB"
88 }, {
89 "HSQL Database Engine Server", "org.hsqldb.jdbcDriver",
90 "jdbc:hsqldb:hsql://localhost"
91 }, {
92 "HSQL Database Engine WebServer", "org.hsqldb.jdbcDriver",
93 "jdbc:hsqldb:http://\u00ABhost?\u00BB"
94 }, {
95 "JDBC-ODBC Bridge from Sun", "sun.jdbc.odbc.JdbcOdbcDriver",
96 "jdbc:odbc:\u00ABdatabase?\u00BB"
97 }, {
98 "Cloudscape RMI", "RmiJdbc.RJDriver",
99 "jdbc:rmi://\u00ABhost?\u00BB:1099/jdbc:cloudscape:"
100 + "\u00ABdatabase?\u00BB;create=true"
101 }, {
102 "IBM DB2", "COM.ibm.db2.jdbc.app.DB2Driver",
103 "jdbc:db2:\u00ABdatabase?\u00BB"
104 }, {
105 "IBM DB2 (thin)", "COM.ibm.db2.jdbc.net.DB2Driver",
106 "jdbc:db2://\u00ABhost?\u00BB:6789/\u00ABdatabase?\u00BB"
107 }, {
108 "Informix", "com.informix.jdbc.IfxDriver",
109 "jdbc:informix-sqli://\u00ABhost?\u00BB:1533/\u00ABdatabase?\u00BB:"
110 + "INFORMIXSERVER=\u00ABserver?\u00BB"
111 }, {
112 "InstantDb", "jdbc.idbDriver",
113 "jdbc:idb:\u00ABdatabase?\u00BB.prp"
114 }, {
115 "MM.MySQL", "org.gjt.mm.mysql.Driver",
116 "jdbc:mysql://\u00ABhost?\u00BB/\u00ABdatabase?\u00BB"
117 }, {
118 "Oracle", "oracle.jdbc.driver.OracleDriver",
119 "jdbc:oracle:oci8:@\u00ABdatabase?\u00BB"
120 }, {
121 "Oracle (thin)", "oracle.jdbc.driver.OracleDriver",
122 "jdbc:oracle:thin:@\u00ABhost?\u00BB:1521:\u00ABdatabase?\u00BB"
123 }, {
124 "PointBase", "com.pointbase.jdbc.jdbcUniversalDriver",
125 "jdbc:pointbase://\u00ABhost?\u00BB/\u00ABdatabase?\u00BB"
126 }, {
127 "PostgreSQL", "org.postgresql.Driver",
128 "jdbc:postgresql://\u00ABhost?\u00BB/\u00ABdatabase?\u00BB"
129 }, {
130 "PostgreSQL v6.5", "postgresql.Driver",
131 "jdbc:postgresql://\u00ABhost?\u00BB/\u00ABdatabase?\u00BB"
132 }
133 };
134
135 static String[][] getTypes() {
136
137 if (connTypes == null) {
138
139 // Pluggable connection types:
140 Vector plugTypes = new Vector();
141
142 try {
143 plugTypes = (Vector) Class.forName(
144 System.getProperty(
145 "org.hsqldb.util.ConnectionTypeClass")).newInstance();
146 } catch (Exception e) {
147 ;
148 }
149
150 connTypes =
151 new String[(plugTypes.size() / 3) + sJDBCTypes.length][3];
152
153 int i = 0;
154
155 for (int j = 0; j < plugTypes.size(); i++) {
156 connTypes[i] = new String[3];
157 connTypes[i][0] = plugTypes.elementAt(j++).toString();
158 connTypes[i][1] = plugTypes.elementAt(j++).toString();
159 connTypes[i][2] = plugTypes.elementAt(j++).toString();
160 }
161
162 for (int j = 0; j < sJDBCTypes.length; i++, j++) {
163 connTypes[i] = new String[3];
164 connTypes[i][0] = sJDBCTypes[j][0];
165 connTypes[i][1] = sJDBCTypes[j][1];
166 connTypes[i][2] = sJDBCTypes[j][2];
167 }
168 }
169
170 return (connTypes);
171 }
172
173 private ConnectionDialogCommon() {}
174 }