Changeset 1477


Ignore:
Timestamp:
Oct 19, 2005, 11:33:18 AM (18 years ago)
Author:
Nicklas Nordborg
Message:

Added db.dynamic.catalog and db.dynamic.schema options.
Added database creation SQL for Mysql and Postgres.

Location:
trunk
Files:
4 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/installation.html

    r1367 r1477  
    5555
    5656  <li>
    57   <p> <i>MySQL</i> <br> Download and install MySQL 4.1, available from
    58   <a href=http://www.mysql.com/>http://www.mysql.com/</a>. You need to
    59   be able to connect to the server over TCP, so the <font
    60   color=#00cc00>skip-networking</font> option must
    61   <strong>not</strong> be used. The InnoDB table engine is also
    62   needed, so don't disable them (not that you would). Hibernate does
    63   support a plethora of database engines, but so far we only work with
    64   MySQL. </p>
    65   </li>
    66 
    67   <li>
    68   <p> <i>Java</i> <br> Download and install Java SDK 1.5, available
    69   from <a href="http://java.sun.com/">http://java.sun.com/</a>. Make
    70   sure that you download the JDK version (<i>not</i> the JRE
    71   version). </p>
    72   </li>
    73 
    74   <li>
    75   <p> <i>ANT</i> <br> Download and install Apache ANT, available from
    76   <a href=http://ant.apache.org/>http://ant.apache.org/</a>. </p>
    77   </li>
    78 
    79   <li>
    80   <p> <i>BASE</i> <br> <a
    81   href="http://base.thep.lu.se/base2/index.html#downloads">Download
    82   BASE 2</a> and unpack the package. </p>
    83 
    84   <p> For now, we assume you download the binary distribution. It is
    85   possible to get BASE running using a source package, or subversion
    86   tree, but not yet fully supported. If you need hints on this please
    87   use the <a href="http://sourceforge.net/mail/?group_id=54527">BASE
    88   developer mailing list</a>. </p>
    89   </li>
    90 
    91   <li>
    92   <p> <i>BASE</i> <br> Create a new database for BASE, and add a
    93   <tt>user</tt> with at least <tt>SELECT</tt>, <tt>INSERT</tt>,
    94   <tt>UPDATE</tt>, <tt>DELETE</tt>, <tt>CREATE</tt>, <tt>DROP</tt>,
    95   <tt>INDEX</tt> and <tt>ALTER</tt> permission for the new
    96   database. Connect to your mysql server and do:
    97 <pre>
     57  <p>
     58    <i>MySQL</i> <br>
     59    Download and install MySQL 4.1, available from
     60    <a href=http://www.mysql.com/>http://www.mysql.com/</a>. You need to
     61    be able to connect to the server over TCP, so the <font
     62    color=#00cc00>skip-networking</font> option must
     63    <strong>not</strong> be used. The InnoDB table engine is also
     64    needed, so don't disable them (not that you would). Hibernate does
     65    support a plethora of database engines, but so far we only work with
     66    MySQL.
     67  </p>
     68  <p>
     69    <i>PostgreSQL</i><br>
     70    Support for PostgresQL is experimental and is not very much tested.
     71    There are still some issues with uploading reporters, reporter maps
     72    (ie. features) and raw data.
     73  </li>
     74
     75  <li>
     76  <p>
     77    <i>Java</i> <br>
     78    Download and install Java SDK 1.5, available
     79    from <a href="http://java.sun.com/">http://java.sun.com/</a>. Make
     80    sure that you download the JDK version (<i>not</i> the JRE
     81    version).
     82  </p>
     83  </li>
     84
     85  <li>
     86  <p>
     87    <i>ANT</i> <br>
     88    Download and install Apache ANT, available from
     89    <a href=http://ant.apache.org/>http://ant.apache.org/</a>.
     90  </p>
     91  </li>
     92
     93  <li>
     94  <p>
     95    <i>BASE</i> <br>
     96    <a
     97    href="http://base.thep.lu.se/base2/index.html#downloads">Download
     98    BASE 2</a> and unpack the package.
     99  </p>
     100
     101  <p>
     102    For now, we assume you download the binary distribution. It is
     103    possible to get BASE running using a source package, or subversion
     104    tree, but not yet fully supported. If you need hints on this please
     105    use the <a href="http://sourceforge.net/mail/?group_id=54527">BASE
     106    developer mailing list</a>.
     107  </p>
     108  </li>
     109
     110  <li>
     111  <p>
     112    <i>BASE</i> <br>
     113    Create a new database for BASE, and add a
     114    <tt>user</tt> with at least <tt>SELECT</tt>, <tt>INSERT</tt>,
     115    <tt>UPDATE</tt>, <tt>DELETE</tt>, <tt>CREATE</tt>, <tt>DROP</tt>,
     116    <tt>INDEX</tt> and <tt>ALTER</tt> permission for the new
     117    database. Connect to your mysql server and do:
     118<pre class="code">
    98119  CREATE DATABASE base2;
    99   GRANT ALL ON base2.* TO user@localhost IDENTIFIED BY 'password';
    100 </pre>
    101   The <tt>user</tt> and <tt>password</tt> is needed when configuring
    102   BASE below.
    103   </p>
    104 
    105   <li>
    106   <p> <i>BASE</i> <br> Configure BASE, in
    107   <tt>base-2.0-alpha5/www/WEB-INF/classes/base.config</tt>:
    108   <ol type=a>
    109     <li> Modify the <font color=#00cc00>db.url</font>, <font
    110     color=#00cc00>db.username</font>, and <font
    111     color=#00cc00>db.password</font> settings to match your choice in
    112     step v) above.</li>
    113     <li> Modify the <font color=#00cc00>logfile</font> and <font
    114     color=#00cc00>userfiles</font> settings.</li>
    115   </ol>
    116   </p>
    117   </li>
    118 
    119   <li>
    120   <p> <i>BASE</i> <br> Change directory to
    121   <tt>base-2.0-alpha5/bin</tt> and run <tt>initdb.sh</tt>. It requires
    122   a single parameter which is the mysql adminisrator
    123   (i.e. <tt>root</tt>) user account password. </p>
    124   </li>
    125 
    126   <li>
    127   <p> <i>tomcat</i> <br> Download and install tomcat 5.0.* or 5.5.*,
    128   available from <a
    129   href=http://jakarta.apache.org/tomcat/>http://jakarta.apache.org/tomcat/</a>.
    130   We have tested BASE with 5.0.30 and 5.5.7, but later version should
    131   also work. The versions we have tested use a built in Java 1.4
    132   compiler, to make it work with Java 1.5 read and follow the
    133   instructions in:
    134   <tt>base-2.0-alpha5/doc/tomcat_with_java_1.5.txt</tt>. </p>
    135 
    136   <li>
    137   <p> <i>BASE/tomcat</i> <br> Either move the
    138   <tt>base-2.0-alpha5/www</tt> directory to the tomcat webapps
    139   directory or create a symbolic link from the tomcat webapps
    140   directory to the <tt>www</tt> directory (<tt>ln -s .../www
    141   base2</tt>). Start/restart tomcat, and try http://hostname/base2
    142   (replace base2 with whatever you use in your tomcat webapps
    143   directory) in your favourite browser, you should expect to see the
    144   BASE login page after a few seconds. </p>
    145 
    146   <p> In some cases when redoing the installation, the behaviour of
    147   tomcat/apache/base may seem strange. This may be due to tomcat's
    148   caching of the applications installed. The easiest way to test
    149   whether the caching creates problems is to simply delete the cached
    150   files. On SuSE 9.3 this is done by
    151 <pre>
     120  CREATE DATABASE base2dynamic;
     121  GRANT ALL ON base2.* TO base2user@localhost IDENTIFIED BY 'password';
     122  GRANT ALL ON base2dynamic.* TO base2user@localhost;
     123</pre>
     124  </p>
     125 
     126  <p>
     127    The <code>base-2.0-alpha5/misc/sql/createdb.mysql.sql</code> file
     128    contains the above statments and can be used by the <code>mysql</code>
     129    command-line tool:
     130  </p>
     131<pre class="code">
     132mysql -uroot -p &lt; ./misc/sql/createdb.mysql.sql
     133</pre>
     134 
     135  <p>
     136    The database names and the <tt>user</tt> and <tt>password</tt> is needed when configuring
     137    BASE below.
     138  </p>
     139
     140  <li>
     141  <p>
     142    <i>BASE</i> <br>
     143    Configure BASE, in
     144    <code>base-2.0-alpha5/www/WEB-INF/classes/base.config</code>:
     145    <ol type=a>
     146      <li>
     147        Modify the <code>db.url</code>,
     148        <code>db.dynamic.catalog</code>, <code>db.username</code>, and
     149        <code>db.password</code> settings to match your choice in
     150        step v) above.
     151      </li>
     152      <li>
     153        Modify the <code>logfile</code> and <code>userfiles</code> settings.
     154      </li>
     155    </ol>
     156  </p>
     157  </li>
     158
     159  <li>
     160  <p>
     161    <i>BASE</i> <br>
     162    Change directory to
     163    <code>base-2.0-alpha5/bin</code> and run <code>initdb.sh</code>. It requires
     164    a single parameter which is the mysql adminisrator
     165    (i.e. <code>root</code>) user account password.
     166  </p>
     167  </li>
     168
     169  <li>
     170  <p>
     171    <i>Tomcat</i> <br>
     172    Download and install tomcat 5.0.* or 5.5.*,
     173    available from <a
     174    href=http://jakarta.apache.org/tomcat/>http://jakarta.apache.org/tomcat/</a>.
     175    We have tested BASE with 5.0.30 and 5.5.7, but later version should
     176    also work. The versions we have tested use a built in Java 1.4
     177    compiler, to make it work with Java 1.5 read and follow the
     178    instructions in:
     179    <code>base-2.0-alpha5/doc/tomcat_with_java_1.5.txt</code>.
     180  </p>
     181
     182  <li>
     183  <p>
     184    <i>BASE/tomcat</i> <br>
     185    Either move the
     186    <code>base-2.0-alpha5/www</code> directory to the tomcat webapps
     187    directory or create a symbolic link from the tomcat webapps
     188    directory to the <code>www</code> directory (<code>ln -s .../www
     189    base2</code>). Start/restart tomcat, and try http://hostname/base2
     190    (replace base2 with whatever you use in your tomcat webapps
     191    directory) in your favourite browser, you should expect to see the
     192    BASE login page after a few seconds.
     193  </p>
     194
     195  <p>
     196    In some cases when redoing the installation, the behaviour of
     197    tomcat/apache/base may seem strange. This may be due to tomcat's
     198    caching of the applications installed. The easiest way to test
     199    whether the caching creates problems is to simply delete the cached
     200    files. On SuSE 9.3 this is done by
     201  </p>
     202 
     203<pre class="code">
    152204  rm -rf /etc/tomcat5/base/Catalina/localhost
    153205  rm -rf ~tomcat/work/Catalina
    154206</pre>
    155   </p>
    156   </li>
    157 
    158   <li>
    159   <p> <i>BASE, apache and apache/tomcat connector</i> <br> This step is
    160   optional, but recommended since the stand-alone tomcat server dies
    161   as soon as it is idle for a while. We have solved this problem by
    162   connection apache and tomcat. If you want run the tomcat server
    163   through the apache web server, you need to install the apache
    164   version 2 web server, available from <a
    165   href="http://www.apache.org/">http://www.apache.org/</a>, and a
    166   apache-tomcat connector, available from <a
    167   href="http://jakarta.apache.org/tomcat/connectors-doc/index.html">http://jakarta.apache.org/tomcat/connectors-doc/index.html</a>.
    168   So, we got you there;-) To be honest, this item is not really well
    169   documented yet since we use SuSE 9.3 on our demo/test server, and
    170   apache/tomcat/mod_jk comes preinstalled. What you need to do is:
    171   <ol type=a>
    172     <li> Get that tomcat server running in stand-alone mode. </li>
    173     <li> Get the apache 2 server running. </li>
    174     <li> Install mod_jk. Note, different version are used for apache
    175     1.3 and 2. In SuSE 9.3 this step is done by installing
    176     <tt>mod_jk-ap20</tt>. </li>
    177     <li> Create a <tt>workers.properties</tt> file in the tomcat
    178     <tt>base</tt> directory (commonly copied from a template). </li>
    179     <li> Create a <tt>jk.conf</tt> file in the apache <tt>conf</tt>
    180     directory (commonly copied from a template), and make sure that
    181     <i>jk</i> is added to the modules to be loaded when apache
    182     starts. </li>
    183     <li> In <tt>jk.conf</tt> add the lines below and change paths
    184     appropriately.
    185     <font color=#00cc00>
    186 <pre>
     207
     208  </li>
     209
     210  <li>
     211  <p>
     212    <i>BASE, apache and apache/tomcat connector</i>
     213    <br> This step is
     214    optional, but recommended since the stand-alone tomcat server dies
     215    as soon as it is idle for a while. We have solved this problem by
     216    connection apache and tomcat. If you want run the tomcat server
     217    through the apache web server, you need to install the apache
     218    version 2 web server, available from <a
     219    href="http://www.apache.org/">http://www.apache.org/</a>, and a
     220    apache-tomcat connector, available from <a
     221    href="http://jakarta.apache.org/tomcat/connectors-doc/index.html">http://jakarta.apache.org/tomcat/connectors-doc/index.html</a>.
     222    So, we got you there;-) To be honest, this item is not really well
     223    documented yet since we use SuSE 9.3 on our demo/test server, and
     224    apache/tomcat/mod_jk comes preinstalled. What you need to do is:
     225    <ol type=a>
     226      <li> Get that tomcat server running in stand-alone mode. </li>
     227      <li> Get the apache 2 server running. </li>
     228      <li> Install mod_jk. Note, different version are used for apache
     229      1.3 and 2. In SuSE 9.3 this step is done by installing
     230        <code>mod_jk-ap20</code>. </li>
     231      <li> Create a <code>workers.properties</code> file in the tomcat
     232        <code>base</code> directory (commonly copied from a template). </li>
     233      <li> Create a <code>jk.conf</code> file in the apache <code>conf</code>
     234        directory (commonly copied from a template), and make sure that
     235        <i>jk</i> is added to the modules to be loaded when apache
     236        starts. </li>
     237      <li> In <code>jk.conf</code> add the lines below and change paths
     238        appropriately.
     239<pre class="code">
    187240  # The following lines makes apache aware of the location of
    188241  # the /base2 context
     
    201254  &lt;/Location&gt;
    202255</pre>
    203     </font>
    204256    </li>
    205257  </ol>
     
    208260
    209261  <li>
    210   <p> Done! Setup of BASE is finished. Happy BASEing. </p>
     262  <p>
     263    Done! Setup of BASE is finished. Happy BASEing.
     264  </p>
    211265  </li>
    212266
     
    215269<h2>BASE 1 to 2 data migration instructions</h2>
    216270
    217 <p> Verify that your BASE 2 installation is up and running before
    218 attempting migration. Preferably try to login using the root user
    219 through the web interface. </p>
     271<p>
     272  Verify that your BASE 2 installation is up and running before
     273  attempting migration. Preferably try to login using the root user
     274  through the web interface.
     275</p>
    220276
    221277<ol type=i>
     
    225281  <ol type=a>
    226282    <li>
    227     Modify <font color=#00cc00>db1.*</font> parameters to match your
     283    Modify <code>db1.*</code> parameters to match your
    228284    BASE 1 installation.
    229285    </li>
    230286    <li>
    231     Modify <font color=#00cc00>root.password</font>, <font
    232     color=#00cc00>userfiles</font> and <font
    233     color=#00cc00>deletefiles</font>. If you set <font
    234     color=#00cc00>deletefiles=yes</font> all BASE 1 files will be
    235     physically removed when moved to BASE 2. Leave <font
    236     color=#00cc00>deletefiles=no</font> unless you are absolutely sure
     287    Modify <code>root.password</code>, <code>userfiles</code> and
     288    <code>deletefiles</code>. If you set <code>deletefiles=yes</code>
     289    all BASE 1 files will be
     290    physically removed when moved to BASE 2. Leave <code>deletefiles=no</code>
     291    unless you are absolutely sure
    237292    of what you are doing.
    238293    </li>
    239294    <li>
    240     Leave the <font color=#00cc00>include*</font> settings unless you
     295    Leave the <code>include*</code> settings unless you
    241296    are absolutely sure of what you are doing.
    242297  </ol>
     
    247302  <p>
    248303  Run migration utility:
    249 <pre>
     304  </p>
     305 
     306<pre class="code">
    250307  cd base-2.0-alpha/dist/bin
    251308  ./migrate_from_1.2.sh
    252309</pre>
    253   </p>
    254310  </li>
    255311
  • trunk/src/base.config.in

    r1474 r1477  
    2323# ----------------------------------------
    2424
     25# =======================
    2526# Database driver section
    26 # -----------------------
     27# =======================
     28
     29# -----
    2730# MySQL
    28 db.dialect  = org.hibernate.dialect.MySQLInnoDBDialect
    29 db.driver = com.mysql.jdbc.Driver
    30 db.url    = jdbc:mysql://localhost/base2
    31 db.queries  = /mysql-queries.xml
     31# -----
     32db.dialect          = org.hibernate.dialect.MySQLInnoDBDialect
     33db.driver           = com.mysql.jdbc.Driver
     34db.url              = jdbc:mysql://localhost/base2?characterEncoding=utf8
     35db.dynamic.catalog  = base2dynamic
     36db.queries          = /mysql-queries.xml
    3237
     38# --------
    3339# Postgres
    34 #db.dialect = org.hibernate.dialect.PostgreSQLDialect
    35 #db.driver  = org.postgresql.Driver
    36 #db.url   = jdbc:postgresql:base2
    37 #db.queries = /postgres-queries.xml
     40# --------
     41#db.dialect          = org.hibernate.dialect.PostgreSQLDialect
     42#db.driver           = org.postgresql.Driver
     43#db.url              = jdbc:postgresql:base2
     44#db.dynamic.catalog  = base2
     45#db.dynamic.schema   = dynamic
     46#db.queries          = /postgres-queries.xml
    3847
     48# -------------
    3949# Common to all
    40 db.username = base2
    41 db.password =
    42 db.dynamic  = base2dynamic
     50# -------------
     51db.username            = base2user
     52db.password            = password
    4353db.extended-properties = /extended-properties.xml
    44 db.raw-data-types = /raw-data-types.xml
    45 db.batch-size = 50
     54db.raw-data-types      = /raw-data-types.xml
     55db.batch-size          = 50
    4656
    4757
     58# ======================
    4859# Authentication section
    49 # ----------------------
     60# ======================
     61
     62# ----------------
     63# POP3 mail server
     64# ----------------
    5065#auth.driver         = net.sf.basedb.core.authentication.POP3Authenticator
    5166#auth.init           = mail.example.com
     
    5469#auth.daystocache    = 0
    5570
     71
     72# ===============
    5673# General section
    57 # ---------------
     74# ===============
     75
    5876# The path to a file where various messages from BASE will be logged
    5977logfile = /usr/local/base2/base.log
     
    6684permission.timeout = 10
    6785
    68 # Number of minutes to keep BaseControl object in the cache
     86# Number of minutes to keep SessionControl object in the cache
    6987# after the last use
    7088cache.timeout = 20
  • trunk/src/core/net/sf/basedb/core/Application.java

    r1474 r1477  
    144144    The name of the dynamic database.
    145145  */
    146   private static String dynamicDb;
     146  private static String dynamicCatalog;
     147 
     148  /**
     149    The name of the dynamic schema.
     150  */
     151  private static String dynamicSchema;
    147152 
    148153  /**
     
    221226    extendedPropertiesFile = Config.getString("db.extended-properties");
    222227    rawDataTypesFile = Config.getString("db.raw-data-types");
    223     dynamicDb = Config.getString("db.dynamic");
     228    dynamicCatalog = Config.getString("db.dynamic.catalog");
     229    dynamicSchema = Config.getString("db.dynamic.schema");
    224230
    225231    // Open the logfile
     
    393399
    394400  /**
    395     Get the name of the dynamic database.
    396   */
    397   static String getDynamicDb()
    398   {
    399     return dynamicDb;
     401    Get the name of the dynamic catalog.
     402  */
     403  static String getDynamicCatalog()
     404  {
     405    return dynamicCatalog;
     406  }
     407 
     408  /**
     409    Get the name of the dynamic schema.
     410  */
     411  static String getDynamicSchema()
     412  {
     413    return dynamicSchema;
    400414  }
    401415
  • trunk/src/core/net/sf/basedb/core/BatchUtil.java

    r1476 r1477  
    257257    char oq = dialect.openQuote();
    258258    char cq = dialect.closeQuote();
     259    String dynamicCatalog = Application.getDynamicCatalog();
     260    String dynamicSchema = Application.getDynamicSchema();
     261   
    259262    StringBuilder sql = new StringBuilder();
    260     // TODO - use dialect information for schema/catalog
    261     sql.append("INSERT INTO ").append(oq).append(Application.getDynamicDb()).append(cq).append(".");
     263    sql.append("INSERT INTO ");
     264    if (dynamicCatalog != null) sql.append(oq).append(dynamicCatalog).append(cq).append(".");
     265    if (dynamicSchema != null) sql.append(oq).append(dynamicSchema).append(cq).append(".");
    262266    sql.append(oq).append(tableName).append(cq);
    263267    sql.append(" (");
     
    276280    }
    277281    sql.append(")");
     282    Application.log("BatchUtil", "buildInsertSql", sql.toString());
    278283    return sql.toString();
    279284  }
  • trunk/src/core/net/sf/basedb/core/Config.java

    r753 r1477  
    8585  {
    8686    assert isInitialised : "Config has not been initialised";
    87     return config.getProperty(key);
     87    return getString(key, null);
    8888  }
    8989
     
    9191    Get the configuration setting specified by <code>key</code> as a String value.
    9292    @param key The key for the setting
    93     @param default_value The value to return if the <code>key</code> is not found
    94     @return The value specified by <code>key</code> or <code>default_value</code>
    95       if it is not found
     93    @param defaultValue The value to return if the <code>key</code> is not found
     94    @return The value specified by <code>key</code> or <code>defaultValue</code>
     95      if it is not found or is empty
    9696  */
    97   public static String getString(String key, String default_value)
     97  public static String getString(String key, String defaultValue)
    9898  {
    9999    assert isInitialised : "Config has not been initialised";
    100     return config.getProperty(key, default_value);
     100    String value = config.getProperty(key, defaultValue);
     101    if (value != null) value.trim();
     102    return "".equals(value) ? defaultValue : value;
    101103  }
    102104
     
    117119
    118120    @param key The key for the setting
    119     @param default_value The value to return if the <code>key</code> is not found
    120     @return The value specified by <code>key</code> or <code>default_value</code>
     121    @param defaultValue The value to return if the <code>key</code> is not found
     122    @return The value specified by <code>key</code> or <code>defaultValue</code>
    121123      if it is not found
    122124  */
    123   public static int getInt(String key, int default_value)
     125  public static int getInt(String key, int defaultValue)
    124126  {
    125127    assert isInitialised : "Config has not been initialised";
    126     int result = default_value;
     128    int result = defaultValue;
    127129    String setting = config.getProperty(key);
    128130    if (setting != null)
  • trunk/src/core/net/sf/basedb/core/HibernateUtil.java

    r1476 r1477  
    215215        // Specify an entity name and database table for the raw data type
    216216        clazz.setAttribute("entity-name", entityName);
    217         clazz.setAttribute("table", tableName);
     217        clazz.setAttribute("table", "`"+tableName+"`");
    218218       
    219219        // Add admin-defnied properties
     
    222222          Element el = new Element("property");
    223223          el.setAttribute("name", property.getName());
    224           el.setAttribute("column", property.getColumn());
     224          el.setAttribute("column", "`"+property.getColumn()+"`");
    225225          el.setAttribute("type", property.getType().getStringValue());
    226226          el.setAttribute("length", Integer.toString(property.getLength()));
     
    373373      Table hibernateTable = getDynamicMapping(db, table, session);
    374374      Dialect dialect = getDialect();
    375       String dynamicDb = dialect.openQuote()+Application.getDynamicDb()+dialect.closeQuote();
    376       String sql = hibernateTable.sqlCreateString(dialect, null, dynamicDb, null);
     375      String dynamicCatalog = quote(Application.getDynamicCatalog());
     376      String dynamicSchema = quote(Application.getDynamicSchema());
     377      String sql = hibernateTable.sqlCreateString(dialect, null, dynamicCatalog, dynamicSchema);
    377378      Application.log("HibernateUtil", "createVirtualTable", sql);
    378379     
     
    385386      {
    386387        Index ii = (Index)i.next();
    387         sql = ii.sqlCreateString(dialect, null, dynamicDb, null);
     388        sql = ii.sqlCreateString(dialect, null, dynamicCatalog, dynamicSchema);
    388389        Application.log("HibernateUtil", "createVirtualTable", sql);
    389390        s.executeUpdate(sql);
     
    423424        Table hibernateTable = getDynamicMapping(db, table, session);
    424425        Dialect dialect = getDialect();
    425         String dynamicDb = dialect.openQuote()+Application.getDynamicDb()+dialect.closeQuote();
    426         String sql = hibernateTable.sqlDropString(dialect, dynamicDb, null);
     426        String dynamicCatalog = quote(Application.getDynamicCatalog());
     427        String dynamicSchema = quote(Application.getDynamicSchema());
     428        String sql = hibernateTable.sqlDropString(dialect, dynamicCatalog, dynamicSchema);
    427429        Application.log("HibernateUtil", "dropVirtualTable", sql);
    428430       
     
    478480  }
    479481 
     482  private static String quote(String value)
     483  {
     484    Dialect d = getDialect();
     485    if (value != null) value = d.openQuote()+value+d.closeQuote();
     486    return value;
     487  }
     488 
    480489  private static boolean tableExists(String tableName, Connection c)
    481490    throws SQLException
     
    486495    {
    487496      DatabaseMetaData metaData = c.getMetaData();
    488       tables = metaData.getTables(Application.getDynamicDb(), null, tableName, null);
     497      tables = metaData.getTables(Application.getDynamicCatalog(), Application.getDynamicSchema(), tableName, null);
    489498      hasTable = tables.next();
    490499    }
     
    533542    if (column.isIndexed())
    534543    {
    535       Dialect dialect = getDialect();
    536544      Index hibernateIndex = new Index();
    537545      hibernateIndex.addColumn(hibernateColumn);
    538       hibernateIndex.setName(dialect.openQuote()+hibernateTable.getName()+column.getName()+dialect.closeQuote());
     546      hibernateIndex.setName(quote(hibernateTable.getName()+column.getName()));
    539547      hibernateIndex.setTable(hibernateTable);
    540548      hibernateTable.addIndex(hibernateIndex);
Note: See TracChangeset for help on using the changeset viewer.