Source code: javatools/db/util/Firebird10DbCreator.java
1 /*
2 * FirebirdDbCreator.java
3 *
4 * Created on 25 febbraio 2003, 18.19
5 Javatools (modified version) - Some useful general classes.
6 Copyright (C) 2002-2003 Chris Bitmead (original) Antonio Petrelli (modified)
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
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 Contact me at: brenmcguire@users.sourceforge.net
23 */
24
25 package javatools.db.util;
26
27 import java.io.*;
28 import java.sql.*;
29 import javatools.db.*;
30 import javatools.util.*;
31 import com.ice.jni.registry.*;
32 import org.firebirdsql.management.FBManager;
33
34 /**
35 *
36 * @author Antonio Petrelli
37 */
38 public class Firebird10DbCreator implements javatools.db.util.DbCreator {
39
40 public void create(DbDatabase base, String dbAddress, int port, String dbName) throws DbException {
41 FBManager manager;
42
43 manager = new FBManager();
44 manager.setServer(dbAddress);
45 if (port > 0)
46 manager.setPort(port);
47 try {
48 manager.start();
49 manager.createDatabase(dbName + ".gdb", base.getUserName(), base.getPassword());
50 }
51 catch (Exception e) {
52 throw new DbException(e.getMessage());
53 }
54 }
55
56
57 private static String[] positions = {"/opt/interbase/bin", "/usr/bin",
58 "/usr/local/bin", "/usr/interbase/bin", "/usr/local/interbase/bin",
59 "/usr/local/firebird/bin"};
60 }