[
https://issues.apache.org/jira/browse/JCR-1366?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12567670#action_12567670
]
Thomas Mueller commented on JCR-1366:
-------------------------------------
Hi,
I see this feature is undocumented. I will document it. Currently the
tablePrefix can only be used to set the catalog and schema name as in:
<param name="tablePrefix" value="ds.">
or (Microsoft SQL Server):
<param name="tablePrefix" value="ds.dbo.">
Could you explain why you like to change the table name (what is the use case)?
> DatabaseMetaData is API is unclear on the parameter to getTables being a
> "tableNamePattern" - should wildcards work?
It used to be unclear, but in recent JDKs this is better documented. It is in
the class level Javadoc:
"Some DatabaseMetaData methods take arguments that are String patterns. These
arguments all have names such as fooPattern. Within a pattern String, "%" means
match any substring of 0 or more characters, and "_" means match any one
character. Only metadata entries matching the search pattern are returned. If a
search pattern argument is set to null, that argument's criterion will be
dropped from the search."
There are still some problems, for example the table name is not always stored
uppercase (MySQL, PostgreSQL). Also, the wildcard escape character (default
should be \) doesn't work with all databases.
Regards,
Thomas
> DbDataStore: tablePrefix not accomodated during init test for existing
> DATASTORE table
> --------------------------------------------------------------------------------------
>
> Key: JCR-1366
> URL: https://issues.apache.org/jira/browse/JCR-1366
> Project: Jackrabbit
> Issue Type: Bug
> Components: jackrabbit-core
> Affects Versions: 1.4
> Environment: jdk 1.6, win xp, SQL SERVER 2007, jTDS jdbc driver
> Reporter: Tyson Norris
>
> we are providing a test db deployment with prepopulated data, including
> jackrabbit DataStore. I tried specifying the tablePrefix when creating the
> initial repository, and tables are created properly.
> However, when a clean installation is run with a fresh database that has an
> existing DataStore (stored at JACKRABBIT_DS_DATASTORE table), the startup
> fails, because during init, the meta data only checks for tables name
> matching the tableSQL property:
> ResultSet rs = meta.getTables(null, null, tableSQL, null);
> but the tableSQL property is never modified based on the tablePrefix property
> (other uses of tableSQL modify queries based on the prefix).
> I think the init method should modify the tested table name based on the
> tablePrefix.
> Note: I assume different JDBC drivers may handle this differently (we are
> using SQL Server 2007 and jTDS driver), since the DatabaseMetaData is API is
> unclear on the parameter to getTables being a "tableNamePattern" - should
> wildcards work? Or should a specific table be specified?
> My DataStore config is below:
> <DataStore class="org.apache.jackrabbit.core.data.db.DbDataStore">
> <param name="className"
> value="org.apache.jackrabbit.core.data.db.DbDataStore"/>
> <param name="url"
> value="jdbc:jtds:SQLServer://localhost:1433/nga_admin;prepareSQL=2;responseBuffering=adaptive"/>
> <param name="user" value="sa"/>
> <param name="password" value=""/>
> <param name="databaseType" value="sqlserver"/>
> <param name="driver" value="net.sourceforge.jtds.jdbc.Driver"/>
> <!-- a bug in jackrabbit makes tablePrefix not work -->
> <param name="tablePrefix" value="JACKRABBIT_DS_">
> <param name="minRecordLength" value="1"/>
> <param name="maxConnections" value="2"/>
> <param name="copyWhenReading" value="true"/>
> </DataStore>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.