You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Alexander Klimetschek <ak...@day.com> on 2008/06/30 12:10:10 UTC

Re: Lookup to datasource to get DB url

Hi Antonio!

You can specify a JNDI data source in the url parameter, but that is
only available for DB persistence managers. See

http://jackrabbit.apache.org/api/1.4/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.html#setUrl(java.lang.String)

The usage of a DbFileSystem is not required if you use a DB
persistence manager. It only stores the workspace.xml config file and
the lucene indexes, which need random access anyway, which you
typically don't have with data stored in a database. The "real" data
is stored via the persistence manager. Hence the recommended
configuration is the combination of a
org.apache.jackrabbit.core.fs.local.LocalFileSystem (storing files in
a normal file system) and a bundle db persistence manager.

Regards,
Alex

On Fri, Jun 27, 2008 at 9:26 PM, MARTINEZ Antonio
<An...@alcatel-lucent.com> wrote:
> Hello,
>
> I'm using JackRabbit with MySql. Currently I configure the db connection
> in repository.xml as
>
>     <FileSystem
>           class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
>           <param name="driver" value="com.mysql.jdbc.Driver"/>
>           <param name="url"
> value="jdbc:mysql://localhost:3307/emlplatform?useUnicode=true&amp;chara
> cterEncoding=UTF-8"     />
>           <param name="user" value="root" />
>           <param name="password" value="mysql" />
>           <param name="schema" value="mysql"/>
>           <param name="schemaObjectPrefix" value="J_R_FS_"/>
>     </FileSystem>
>
> However, in my case I need to obtain the url at deployment time. That
> information in my case is in data source mysql-ds.xml of the Jboss
> "deploy" directory.
>
> Is there a way to do a lookup. If I need to modify the persistence
> manager could someone point where to do it?
>
> Thank-you,
> Antonio
>



-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Re: Lookup to datasource to get DB url

Posted by Thomas Müller <th...@day.com>.
Hi,

> However my main question is "How to do a lookup of a data  source" that
> contains the real url parameter.

I think Antonio has already answered this question: You can specify a
JNDI data source in the url parameter. Example:

<PersistenceManager
class="org.apache.jackrabbit.core.persistence.bundle.MySqlPersistenceManager">
  <param name="driver" value="javax.naming.InitialContext"/>
  <param name="url" value="java:comp/env/jdbc/Test"/>
  <param name="schemaObjectPrefix" value="con_"/>
</PersistenceManager>

Regards,
Thomas

RE: Lookup to datasource to get DB url

Posted by MARTINEZ Antonio <An...@alcatel-lucent.com>.
Hi Alex,

Thanks for your answer.

However my main question is "How to do a lookup of a data  source" that
contains the real url parameter.
In my case I can NOT allow JackRabbit to use the url in repository.xml
because I do not know the real url when I package the product.

        <PersistenceManager
class="org.apache.jackrabbit.core.persistence.bundle.MySqlPersistenceMan
ager">
          <param name="driver" value="com.mysql.jdbc.Driver"/>
          <param name="url"
value="jdbc:mysql://localhost:3306/emlplatform"/>
          <param name="user" value="root"/>
          <param name="password" value="mysql"/>
          <param name="schemaObjectPrefix" value="con_"/>
        </PersistenceManager>

I need JackRabbit to do a lookup to a data source (mysql-ds.xml) when
JackRabbit is deployed on Jboss.
Any idea hw to do that?

Thanks,
Antonio

-----Original Message-----
From: Alexander Klimetschek [mailto:aklimets@day.com] 
Sent: Monday, June 30, 2008 3:10 AM
To: users@jackrabbit.apache.org
Subject: Re: Lookup to datasource to get DB url

Hi Antonio!

You can specify a JNDI data source in the url parameter, but that is
only available for DB persistence managers. See

http://jackrabbit.apache.org/api/1.4/org/apache/jackrabbit/core/persiste
nce/bundle/BundleDbPersistenceManager.html#setUrl(java.lang.String)

The usage of a DbFileSystem is not required if you use a DB persistence
manager. It only stores the workspace.xml config file and the lucene
indexes, which need random access anyway, which you typically don't have
with data stored in a database. The "real" data is stored via the
persistence manager. Hence the recommended configuration is the
combination of a org.apache.jackrabbit.core.fs.local.LocalFileSystem
(storing files in a normal file system) and a bundle db persistence
manager.

Regards,
Alex

On Fri, Jun 27, 2008 at 9:26 PM, MARTINEZ Antonio
<An...@alcatel-lucent.com> wrote:
> Hello,
>
> I'm using JackRabbit with MySql. Currently I configure the db 
> connection in repository.xml as
>
>     <FileSystem
>           class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
>           <param name="driver" value="com.mysql.jdbc.Driver"/>
>           <param name="url"
>
value="jdbc:mysql://localhost:3307/emlplatform?useUnicode=true&amp;chara
> cterEncoding=UTF-8"     />
>           <param name="user" value="root" />
>           <param name="password" value="mysql" />
>           <param name="schema" value="mysql"/>
>           <param name="schemaObjectPrefix" value="J_R_FS_"/>
>     </FileSystem>
>
> However, in my case I need to obtain the url at deployment time. That 
> information in my case is in data source mysql-ds.xml of the Jboss 
> "deploy" directory.
>
> Is there a way to do a lookup. If I need to modify the persistence 
> manager could someone point where to do it?
>
> Thank-you,
> Antonio
>



--
Alexander Klimetschek
alexander.klimetschek@day.com