You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by mi...@lidp.com on 2005/12/15 22:41:32 UTC

Database persistent storage

First time mailer...

I have successfully downloaded Apache Jackrabbit, and 
developed (from a variety of sources) a couple of working 
repositories.  Further, I haven't added anything to the standard
configuration.  

e.g.

/home/milhri
    JCRTest.java
    repotest 
    JackTest.java
    repotest2

/home/milhri/repotest2
    jaas.config
    repository
    repository.xml
    versions
    workspaces

In both cases, I am using local flat files for persistent storage.
I need to demo persistent data storage in a database.  

Database server        = DB2/6000 8.2.1

We currently use this database as persistent storage for a J2EE
application.

Can someone lend assistance getting a similar example program to 
persist data in the database above?  

Thanks.

-- 
                                            Sincerely,

                                               Rick Milheron
                                               FLMI,ACS
                                               LIDP Consulting, Inc.
                                               Phone 630.829.7136
                                               milhri@lidp.com
                                               nihilum in temperantia

Re: Database persistent storage

Posted by mi...@lidp.com.
Edgar


	Ok here is what I have:

/home/milhri
/home/milhri/repotestdb
-rw-r--r--  1 milhri lidp  104 Dec 15 10:08 jaas.config
-rw-r--r--  1 milhri lidp 2031 Dec 16 11:53 repository.xml


	I can start from this point using one of my flat file jackrabbit
programs, and all is well, including the building of the workspaces
directory as you outline.  The only thing I change when trying the
database version is the repository.xml file.

	However, starting from the same place with my database version

/home/milhri
/home/milhri/repotestdb
-rw-r--r--  1 milhri lidp  104 Dec 15 10:08 jaas.config
-rw-r--r--  1 milhri lidp 2031 Dec 16 11:53 repository.xml


	I still get 

init >>>>>>>>>>>>org.apache.jackrabbit.core.config.ConfigurationException: Replacement not found for ${wsp.name}.


	The exception occurs before a print statement in my init method, 
as I never see that.  

    try
    {
// Obtaining a Repository object with JNDI

      String configFile = "repotestdb/repository.xml";
      String repHomeDir = "repotestdb";

      Hashtable env = new Hashtable();
      env.put(Context.INITIAL_CONTEXT_FACTORY,
              "org.apache.jackrabbit.core.jndi" +
              ".provider.DummyInitialContextFactory");

      env.put(Context.PROVIDER_URL,"localhost");

      InitialContext ctx = new InitialContext(env);

      RegistryHelper.registerRepository(ctx,"repo",configFile,repHomeDir,true);

      Repository repository = (Repository)ctx.lookup("repo");

      System.out.println("1.  init()______________________________________________\n");


	Here is the repository.xml config file.


        <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
            <param name="driver" value="COM.ibm.db2.jdbc.app.DB2Driver"/>
            <param name="url" value="jdbc:db2:a2test"/>
            <param name="user" value="a2test"/>
            <param name="password" value="a2test"/>
            <param name="schema" value="mysql"/>
            <param name="schemaObjectPrefix" value="${wsp.name}_"/>
            <param name="externalBLOBs" value="false"/>
        </PersistenceManager>



Question:

Jackrabbit should be making the connection to the database, yes?  That
is, I don't have to do so explicitly in my program?



Thanks.





On Fri, Dec 16, 2005 at 02:43:03PM -0300, Edgar Poce wrote:
> Hi rick,
> 
> On 12/16/05, milhri@lidp.com <mi...@lidp.com> wrote:
> > Edgar
> >
> >         Here is where I am to date:
> >
> > /home/milhri/repotestdb
> >         jaas.config
> >         repository.xml
> >
> >     <Workspace name="${wsp.name}">
> ...
> >     </Workspace>
> 
> AFAIK the workspace part of the repository.xml[1] is used as a
> template to create the workspace.xml[2], which contains the workspace
> specific settings. Once you changed the repository.xml settings the
> existing workspaces configurations do not change. I'm not sure, but I
> think that might be the cause of your problem.
> 
> Try to remove every folder under the repository home ("repository" and
> "workspaces"), modify the repository.xml to match your db config and
> run jackrabbit. Jackrabbit should fill the ${xxx} variables for the
> default workspace or any other workspace you create.
> 
> hope this helps,
> edgar
> 
> [1] ${JACKRABBIT_HOME}/repository.xml
> [2] ${JACKRABBIT_HOME}/workspaces/${WORKSPACE_NAME}/workspace.xml
> 
> 
> 
> 
> >
> >
> >         I built a test program to exercise java.sql.DatabaseMetaData and
> > the connection utility I am using looks like
> >
> >       try
> >       {
> >          String driverStr = "jdbc:db2:"+dbname;
> >          Class driveClass = Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
> >          con = DriverManager.getConnection(driverStr, username, pwsd);
> >       }
> >
> > where dbname = "a2test", username = "a2test", and pwsd = "a2test".
> > My test program functions properly
> >
> >
> > e.g.
> >
> > /home/milhri/QueryDbMeta.java
> >
> > 1. ------------------------------------------
> > Database product name is DB2/6000
> >
> >
> > 2. ------------------------------------------
> > schema preferred term is schema
> >
> >
> > schemas available
> > A2TEST
> > NULLID
> > SQLJ
> > SYSCAT
> > SYSFUN
> > SYSIBM
> > SYSPROC
> > SYSSTAT
> > SYSTOOLS
> >
> > etc.
> >
> >         When I attempt to run my jackrabbit program, I get
> >
> > /home/milhri>java -Djava.security.auth.login.config==/home/milhri/repotestdb/jaas.config JCRDbTest > testdb
> >
> > init >>>>>>>>>>>>org.apache.jackrabbit.core.config.ConfigurationException: Replacement not found for ${wsp.name}.
> > checkRootNode >>>>>>>>>>>>java.lang.NullPointerException
> > createNamespace >>>>>>>>>>>>java.lang.NullPointerException
> > addContent >>>>>>>>>>>>java.lang.NullPointerException
> > browseContent >>>>>>>>>>>>java.lang.NullPointerException
> > browseAll >>>>>>>>>>>>java.lang.NullPointerException
> >
> >
> >         Any ideas why the ${wsp.name} is not found?
> >
> > Thanks.
> >
> >
> >
> > On Thu, Dec 15, 2005 at 09:42:28PM -0300, Edgar Poce wrote:
> > > Hi rick,
> > >
> > >  you can take a look to
> > > http://incubator.apache.org/jackrabbit/apidocs/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.html,
> > > it contains documentation and examples that will help you to configure your
> > > jdbc connection.
> > >
> > > br,
> > > edgar
> > >
> > > milhri@lidp.com wrote:
> > > >First time mailer...
> > > >
> > > >I have successfully downloaded Apache Jackrabbit, and
> > > >developed (from a variety of sources) a couple of working
> > > >repositories.  Further, I haven't added anything to the standard
> > > >configuration.
> > > >
> > > >e.g.
> > > >
> > > >/home/milhri
> > > >    JCRTest.java
> > > >    repotest
> > > >    JackTest.java
> > > >    repotest2
> > > >
> > > >/home/milhri/repotest2
> > > >    jaas.config
> > > >    repository
> > > >    repository.xml
> > > >    versions
> > > >    workspaces
> > > >
> > > >In both cases, I am using local flat files for persistent storage.
> > > >I need to demo persistent data storage in a database.
> > > >
> > > >Database server        = DB2/6000 8.2.1
> > > >
> > > >We currently use this database as persistent storage for a J2EE
> > > >application.
> > > >
> > > >Can someone lend assistance getting a similar example program to
> > > >persist data in the database above?
> > > >
> > > >Thanks.
> > > >
> > >
> >
> > --
> >                                             Sincerely,
> >
> >                                                Rick Milheron
> >                                                FLMI,ACS
> >                                                LIDP Consulting, Inc.
> >                                                Phone 630.829.7136
> >                                                milhri@lidp.com
> >                                                nihilum in temperantia
> >
> 

-- 
                                            Sincerely,

                                               Rick Milheron
                                               FLMI,ACS
                                               LIDP Consulting, Inc.
                                               Phone 630.829.7136
                                               milhri@lidp.com
                                               nihilum in temperantia

Re: Database persistent storage

Posted by Stefan Guggisberg <st...@gmail.com>.
hi rick
i guess you will have to do some debugging ;) first of all
we need to know at which location in SimpleDbPersistenceManager
the exception is thrown. a full stack trace would be ideal.
what sql stmt caused the exception? etc etc

set breakpoints in the follwing methods of SimpleDbPersistenceManager:
#store(NodeState)
#store(PropertyState)
and step through the code.

also provide complete repository.xml *and* workspace.xml.

cheers
stefan

On 12/16/05, milhri@lidp.com <mi...@lidp.com> wrote:
> Edgar et.al.
>
>
>         Status report on DB2 persistent storage.  Have a problem with
> keys, I think.
>
> 1.
>
> Beginning from
>
> /home/milhri/repotestdb
>         jaas.config
>         repository.xml
>
>         <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
>             <param name="driver" value="COM.ibm.db2.jdbc.app.DB2Driver"/>
>             <param name="url" value="jdbc:db2:a2test"/>
>             <param name="user" value="a2test"/>
>             <param name="password" value="a2test"/>
>             <param name="schema" value="derby"/>
>             <param name="schemaObjectPrefix" value="${wsp.name}_"/>
>             <param name="externalBLOBs" value="false"/>
>         </PersistenceManager
>
> Executed program, got exception
>
> org.apache.jackrabbit.core.config.ConfigurationException: Replacement
> not found for ${wsp.name}
>
>
> 2.
>
> Hardcoded all ${wsp.name} to 'default', executed program.
>
> Got an error from db2 indicating columns were in excess of 1024.
>
> (Can provide more complete information if someone wants it).
>
> 3.
>
> Checked manual found that columns are max 1024 plus overhead.
>
> Made a new .ddl 'db2.ddl' where
>
> create table ${schemaObjectPrefix}PROP (PROP_ID varchar(1000)
> create table ${schemaObjectPrefix}BINVAL (BINVAL_ID varchar(1000)
>
> Changed repository.xml
>
>         <PersistenceManager
> class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
>             <param name="driver" value="COM.ibm.db2.jdbc.app.DB2Driver"/>
>             <param name="url" value="jdbc:db2:a2test"/>
>             <param name="user" value="a2test"/>
>             <param name="password" value="a2test"/>
>             <param name="schema" value="db2"/>
>             <param name="schemaObjectPrefix" value="default_"/>
>             <param name="externalBLOBs" value="false"/>
>         </PersistenceManager>
>
> 4.
>
> Executed program, got
>
> init >>>>>>>>>>>>javax.jcr.RepositoryException: /: unable to update
> item.: failed to write property state:
> deadbeef-face-babe-cafe-babecafebabe/{http://www.jcp.org/jcr/1.0}primaryType:
> [IBM][CLI Driver][DB2/6000] SQL0803N  One or more values in the INSERT
> statement, UPDATE statement, or foreign key update caused by a DELETE
> statement are not valid because the primary key, unique constraint or
> unique index identified by "1" constrains table "A2TEST.DEFAULT_PROP"
> from having duplicate rows for those columns.  SQLSTATE=23505
> : failed to write property state:
> deadbeef-face-babe-cafe-babecafebabe/{http://www.jcp.org/jcr/1.0}primaryType:
> [IBM][CLI Driver][DB2/6000] SQL0803N  One or more values in the INSERT
> statement, UPDATE statement, or foreign key update caused by a DELETE
> statement are not valid because the primary key, unique constraint or
> unique index identified by "1" constrains table "A2TEST.DEFAULT_PROP"
> from having duplicate rows for those columns.  SQLSTATE=23505
>
>         Directory structure looks like
>
> /home/milhri/repotestdb
>         jaas.config
>         repository
>                 meta
>                         rep.properties
>                         rootUUID
>                 namespaces
>                         ns_reg.properties
>                 nodetypes
>         repository.xml
>         versions
>         workspaces
>                 default
>                         workspace.xml
>
>
>         Tables are created
>
> Database product name is DB2/6000
>
>
> Schema A2TEST Table DEFAULT_BINVAL Column BINVAL_ID
> Schema A2TEST Table DEFAULT_BINVAL Column BINVAL_DATA
> Schema A2TEST Table DEFAULT_NODE Column NODE_ID
> Schema A2TEST Table DEFAULT_NODE Column NODE_DATA
> Schema A2TEST Table DEFAULT_PROP Column PROP_ID
> Schema A2TEST Table DEFAULT_PROP Column PROP_DATA
> Schema A2TEST Table DEFAULT_REFS Column NODE_ID
> Schema A2TEST Table DEFAULT_REFS Column REFS_DATA
>
>         And have some entries
>
> db2 "select * from DEFAULT_NODE"
>
> NODE_ID                              NODE_DATA
> ------------------------------------ -------------------------------
> deadbeef-face-babe-cafe-babecafebabe x'00187B696E7465726E616C7D76657
> cafebabe-cafe-babe-cafe-babecafebabe x'000E7B696E7465726E616C7D726F6
>
>
> db2 "select * from DEFAULT_PROP"
>
> PROP_ID
> ----------------------------------------------------------------------------
> deadbeef-face-babe-cafe-babecafebabe/{http://www.jcp.org/jcr/1.0}primaryType
> cafebabe-cafe-babe-cafe-babecafebabe/{http://www.jcp.org/jcr/1.0}primaryType
>
> PROP_DATA
> --------------------------------------------------------------------------
> x'0000000700000A31323636363637313430000000000001000000187B696E7465726E61
> x'0000000700000A313236363636373134300000000000010000000E7B696E7465726E61
>
>
> db2 "select * from DEFAULT_REFS"
>
> NODE_ID                              REFS_DATA
> ------------------------------------ --------------------------------------
>   0 record(s) selected.
>
>
> db2 "select * from DEFAULT_BINVAL"
>
> BINVAL_ID                           BINVAL_DATA
> ----------------------------------- --------------------------------------
>   0 record(s) selected.
>
>
>
> On Fri, Dec 16, 2005 at 02:43:03PM -0300, Edgar Poce wrote:
> > Hi rick,
> >
> > On 12/16/05, milhri@lidp.com <mi...@lidp.com> wrote:
> > > Edgar
> > >
> > >         Here is where I am to date:
> > >
> > > /home/milhri/repotestdb
> > >         jaas.config
> > >         repository.xml
> > >
> > >     <Workspace name="${wsp.name}">
> > ...
> > >     </Workspace>
> >
> > AFAIK the workspace part of the repository.xml[1] is used as a
> > template to create the workspace.xml[2], which contains the workspace
> > specific settings. Once you changed the repository.xml settings the
> > existing workspaces configurations do not change. I'm not sure, but I
> > think that might be the cause of your problem.
> >
> > Try to remove every folder under the repository home ("repository" and
> > "workspaces"), modify the repository.xml to match your db config and
> > run jackrabbit. Jackrabbit should fill the ${xxx} variables for the
> > default workspace or any other workspace you create.
> >
> > hope this helps,
> > edgar
> >
> > [1] ${JACKRABBIT_HOME}/repository.xml
> > [2] ${JACKRABBIT_HOME}/workspaces/${WORKSPACE_NAME}/workspace.xml
> >
> >
> >
> >
> > >
> > >
> > >         I built a test program to exercise java.sql.DatabaseMetaData and
> > > the connection utility I am using looks like
> > >
> > >       try
> > >       {
> > >          String driverStr = "jdbc:db2:"+dbname;
> > >          Class driveClass = Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
> > >          con = DriverManager.getConnection(driverStr, username, pwsd);
> > >       }
> > >
> > > where dbname = "a2test", username = "a2test", and pwsd = "a2test".
> > > My test program functions properly
> > >
> > >
> > > e.g.
> > >
> > > /home/milhri/QueryDbMeta.java
> > >
> > > 1. ------------------------------------------
> > > Database product name is DB2/6000
> > >
> > >
> > > 2. ------------------------------------------
> > > schema preferred term is schema
> > >
> > >
> > > schemas available
> > > A2TEST
> > > NULLID
> > > SQLJ
> > > SYSCAT
> > > SYSFUN
> > > SYSIBM
> > > SYSPROC
> > > SYSSTAT
> > > SYSTOOLS
> > >
> > > etc.
> > >
> > >         When I attempt to run my jackrabbit program, I get
> > >
> > > /home/milhri>java -Djava.security.auth.login.config==/home/milhri/repotestdb/jaas.config JCRDbTest > testdb
> > >
> > > init >>>>>>>>>>>>org.apache.jackrabbit.core.config.ConfigurationException: Replacement not found for ${wsp.name}.
> > > checkRootNode >>>>>>>>>>>>java.lang.NullPointerException
> > > createNamespace >>>>>>>>>>>>java.lang.NullPointerException
> > > addContent >>>>>>>>>>>>java.lang.NullPointerException
> > > browseContent >>>>>>>>>>>>java.lang.NullPointerException
> > > browseAll >>>>>>>>>>>>java.lang.NullPointerException
> > >
> > >
> > >         Any ideas why the ${wsp.name} is not found?
> > >
> > > Thanks.
> > >
> > >
> > >
> > > On Thu, Dec 15, 2005 at 09:42:28PM -0300, Edgar Poce wrote:
> > > > Hi rick,
> > > >
> > > >  you can take a look to
> > > > http://incubator.apache.org/jackrabbit/apidocs/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.html,
> > > > it contains documentation and examples that will help you to configure your
> > > > jdbc connection.
> > > >
> > > > br,
> > > > edgar
> > > >
> > > > milhri@lidp.com wrote:
> > > > >First time mailer...
> > > > >
> > > > >I have successfully downloaded Apache Jackrabbit, and
> > > > >developed (from a variety of sources) a couple of working
> > > > >repositories.  Further, I haven't added anything to the standard
> > > > >configuration.
> > > > >
> > > > >e.g.
> > > > >
> > > > >/home/milhri
> > > > >    JCRTest.java
> > > > >    repotest
> > > > >    JackTest.java
> > > > >    repotest2
> > > > >
> > > > >/home/milhri/repotest2
> > > > >    jaas.config
> > > > >    repository
> > > > >    repository.xml
> > > > >    versions
> > > > >    workspaces
> > > > >
> > > > >In both cases, I am using local flat files for persistent storage.
> > > > >I need to demo persistent data storage in a database.
> > > > >
> > > > >Database server        = DB2/6000 8.2.1
> > > > >
> > > > >We currently use this database as persistent storage for a J2EE
> > > > >application.
> > > > >
> > > > >Can someone lend assistance getting a similar example program to
> > > > >persist data in the database above?
> > > > >
> > > > >Thanks.
> > > > >
> > > >
> > >
> > > --
> > >                                             Sincerely,
> > >
> > >                                                Rick Milheron
> > >                                                FLMI,ACS
> > >                                                LIDP Consulting, Inc.
> > >                                                Phone 630.829.7136
> > >                                                milhri@lidp.com
> > >                                                nihilum in temperantia
> > >
> >
>
> --
>                                             Sincerely,
>
>                                                Rick Milheron
>                                                FLMI,ACS
>                                                LIDP Consulting, Inc.
>                                                Phone 630.829.7136
>                                                milhri@lidp.com
>                                                nihilum in temperantia
>

Re: Database persistent storage

Posted by mi...@lidp.com.
Edgar et.al.


	Status report on DB2 persistent storage.  Have a problem with
keys, I think.

1.

Beginning from 

/home/milhri/repotestdb
	jaas.config
	repository.xml

        <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
            <param name="driver" value="COM.ibm.db2.jdbc.app.DB2Driver"/>
            <param name="url" value="jdbc:db2:a2test"/>
            <param name="user" value="a2test"/>
            <param name="password" value="a2test"/>
            <param name="schema" value="derby"/>
            <param name="schemaObjectPrefix" value="${wsp.name}_"/>
            <param name="externalBLOBs" value="false"/>
        </PersistenceManager

Executed program, got exception

org.apache.jackrabbit.core.config.ConfigurationException: Replacement
not found for ${wsp.name}


2.  

Hardcoded all ${wsp.name} to 'default', executed program.

Got an error from db2 indicating columns were in excess of 1024.

(Can provide more complete information if someone wants it).

3.

Checked manual found that columns are max 1024 plus overhead.

Made a new .ddl 'db2.ddl' where

create table ${schemaObjectPrefix}PROP (PROP_ID varchar(1000)
create table ${schemaObjectPrefix}BINVAL (BINVAL_ID varchar(1000)

Changed repository.xml

        <PersistenceManager
class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
            <param name="driver" value="COM.ibm.db2.jdbc.app.DB2Driver"/>
            <param name="url" value="jdbc:db2:a2test"/>
            <param name="user" value="a2test"/>
            <param name="password" value="a2test"/>
            <param name="schema" value="db2"/>
            <param name="schemaObjectPrefix" value="default_"/>
            <param name="externalBLOBs" value="false"/>
        </PersistenceManager>

4.

Executed program, got 

init >>>>>>>>>>>>javax.jcr.RepositoryException: /: unable to update
item.: failed to write property state:
deadbeef-face-babe-cafe-babecafebabe/{http://www.jcp.org/jcr/1.0}primaryType:
[IBM][CLI Driver][DB2/6000] SQL0803N  One or more values in the INSERT
statement, UPDATE statement, or foreign key update caused by a DELETE
statement are not valid because the primary key, unique constraint or
unique index identified by "1" constrains table "A2TEST.DEFAULT_PROP"
from having duplicate rows for those columns.  SQLSTATE=23505
: failed to write property state:
deadbeef-face-babe-cafe-babecafebabe/{http://www.jcp.org/jcr/1.0}primaryType:
[IBM][CLI Driver][DB2/6000] SQL0803N  One or more values in the INSERT
statement, UPDATE statement, or foreign key update caused by a DELETE
statement are not valid because the primary key, unique constraint or
unique index identified by "1" constrains table "A2TEST.DEFAULT_PROP"
from having duplicate rows for those columns.  SQLSTATE=23505

	Directory structure looks like

/home/milhri/repotestdb
	jaas.config
	repository
		meta
			rep.properties
			rootUUID
		namespaces
			ns_reg.properties
		nodetypes
	repository.xml
	versions
	workspaces
		default
			workspace.xml


	Tables are created

Database product name is DB2/6000


Schema A2TEST Table DEFAULT_BINVAL Column BINVAL_ID
Schema A2TEST Table DEFAULT_BINVAL Column BINVAL_DATA
Schema A2TEST Table DEFAULT_NODE Column NODE_ID
Schema A2TEST Table DEFAULT_NODE Column NODE_DATA
Schema A2TEST Table DEFAULT_PROP Column PROP_ID
Schema A2TEST Table DEFAULT_PROP Column PROP_DATA
Schema A2TEST Table DEFAULT_REFS Column NODE_ID
Schema A2TEST Table DEFAULT_REFS Column REFS_DATA

	And have some entries 

db2 "select * from DEFAULT_NODE"

NODE_ID                              NODE_DATA
------------------------------------ -------------------------------
deadbeef-face-babe-cafe-babecafebabe x'00187B696E7465726E616C7D76657
cafebabe-cafe-babe-cafe-babecafebabe x'000E7B696E7465726E616C7D726F6


db2 "select * from DEFAULT_PROP"

PROP_ID
----------------------------------------------------------------------------
deadbeef-face-babe-cafe-babecafebabe/{http://www.jcp.org/jcr/1.0}primaryType
cafebabe-cafe-babe-cafe-babecafebabe/{http://www.jcp.org/jcr/1.0}primaryType

PROP_DATA
--------------------------------------------------------------------------
x'0000000700000A31323636363637313430000000000001000000187B696E7465726E61
x'0000000700000A313236363636373134300000000000010000000E7B696E7465726E61


db2 "select * from DEFAULT_REFS"

NODE_ID                              REFS_DATA
------------------------------------ --------------------------------------
  0 record(s) selected.


db2 "select * from DEFAULT_BINVAL"

BINVAL_ID                           BINVAL_DATA
----------------------------------- --------------------------------------
  0 record(s) selected.



On Fri, Dec 16, 2005 at 02:43:03PM -0300, Edgar Poce wrote:
> Hi rick,
> 
> On 12/16/05, milhri@lidp.com <mi...@lidp.com> wrote:
> > Edgar
> >
> >         Here is where I am to date:
> >
> > /home/milhri/repotestdb
> >         jaas.config
> >         repository.xml
> >
> >     <Workspace name="${wsp.name}">
> ...
> >     </Workspace>
> 
> AFAIK the workspace part of the repository.xml[1] is used as a
> template to create the workspace.xml[2], which contains the workspace
> specific settings. Once you changed the repository.xml settings the
> existing workspaces configurations do not change. I'm not sure, but I
> think that might be the cause of your problem.
> 
> Try to remove every folder under the repository home ("repository" and
> "workspaces"), modify the repository.xml to match your db config and
> run jackrabbit. Jackrabbit should fill the ${xxx} variables for the
> default workspace or any other workspace you create.
> 
> hope this helps,
> edgar
> 
> [1] ${JACKRABBIT_HOME}/repository.xml
> [2] ${JACKRABBIT_HOME}/workspaces/${WORKSPACE_NAME}/workspace.xml
> 
> 
> 
> 
> >
> >
> >         I built a test program to exercise java.sql.DatabaseMetaData and
> > the connection utility I am using looks like
> >
> >       try
> >       {
> >          String driverStr = "jdbc:db2:"+dbname;
> >          Class driveClass = Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
> >          con = DriverManager.getConnection(driverStr, username, pwsd);
> >       }
> >
> > where dbname = "a2test", username = "a2test", and pwsd = "a2test".
> > My test program functions properly
> >
> >
> > e.g.
> >
> > /home/milhri/QueryDbMeta.java
> >
> > 1. ------------------------------------------
> > Database product name is DB2/6000
> >
> >
> > 2. ------------------------------------------
> > schema preferred term is schema
> >
> >
> > schemas available
> > A2TEST
> > NULLID
> > SQLJ
> > SYSCAT
> > SYSFUN
> > SYSIBM
> > SYSPROC
> > SYSSTAT
> > SYSTOOLS
> >
> > etc.
> >
> >         When I attempt to run my jackrabbit program, I get
> >
> > /home/milhri>java -Djava.security.auth.login.config==/home/milhri/repotestdb/jaas.config JCRDbTest > testdb
> >
> > init >>>>>>>>>>>>org.apache.jackrabbit.core.config.ConfigurationException: Replacement not found for ${wsp.name}.
> > checkRootNode >>>>>>>>>>>>java.lang.NullPointerException
> > createNamespace >>>>>>>>>>>>java.lang.NullPointerException
> > addContent >>>>>>>>>>>>java.lang.NullPointerException
> > browseContent >>>>>>>>>>>>java.lang.NullPointerException
> > browseAll >>>>>>>>>>>>java.lang.NullPointerException
> >
> >
> >         Any ideas why the ${wsp.name} is not found?
> >
> > Thanks.
> >
> >
> >
> > On Thu, Dec 15, 2005 at 09:42:28PM -0300, Edgar Poce wrote:
> > > Hi rick,
> > >
> > >  you can take a look to
> > > http://incubator.apache.org/jackrabbit/apidocs/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.html,
> > > it contains documentation and examples that will help you to configure your
> > > jdbc connection.
> > >
> > > br,
> > > edgar
> > >
> > > milhri@lidp.com wrote:
> > > >First time mailer...
> > > >
> > > >I have successfully downloaded Apache Jackrabbit, and
> > > >developed (from a variety of sources) a couple of working
> > > >repositories.  Further, I haven't added anything to the standard
> > > >configuration.
> > > >
> > > >e.g.
> > > >
> > > >/home/milhri
> > > >    JCRTest.java
> > > >    repotest
> > > >    JackTest.java
> > > >    repotest2
> > > >
> > > >/home/milhri/repotest2
> > > >    jaas.config
> > > >    repository
> > > >    repository.xml
> > > >    versions
> > > >    workspaces
> > > >
> > > >In both cases, I am using local flat files for persistent storage.
> > > >I need to demo persistent data storage in a database.
> > > >
> > > >Database server        = DB2/6000 8.2.1
> > > >
> > > >We currently use this database as persistent storage for a J2EE
> > > >application.
> > > >
> > > >Can someone lend assistance getting a similar example program to
> > > >persist data in the database above?
> > > >
> > > >Thanks.
> > > >
> > >
> >
> > --
> >                                             Sincerely,
> >
> >                                                Rick Milheron
> >                                                FLMI,ACS
> >                                                LIDP Consulting, Inc.
> >                                                Phone 630.829.7136
> >                                                milhri@lidp.com
> >                                                nihilum in temperantia
> >
> 

-- 
                                            Sincerely,

                                               Rick Milheron
                                               FLMI,ACS
                                               LIDP Consulting, Inc.
                                               Phone 630.829.7136
                                               milhri@lidp.com
                                               nihilum in temperantia

Re: Database persistent storage

Posted by Edgar Poce <ed...@gmail.com>.
Hi rick,

On 12/16/05, milhri@lidp.com <mi...@lidp.com> wrote:
> Edgar
>
>         Here is where I am to date:
>
> /home/milhri/repotestdb
>         jaas.config
>         repository.xml
>
>     <Workspace name="${wsp.name}">
...
>     </Workspace>

AFAIK the workspace part of the repository.xml[1] is used as a
template to create the workspace.xml[2], which contains the workspace
specific settings. Once you changed the repository.xml settings the
existing workspaces configurations do not change. I'm not sure, but I
think that might be the cause of your problem.

Try to remove every folder under the repository home ("repository" and
"workspaces"), modify the repository.xml to match your db config and
run jackrabbit. Jackrabbit should fill the ${xxx} variables for the
default workspace or any other workspace you create.

hope this helps,
edgar

[1] ${JACKRABBIT_HOME}/repository.xml
[2] ${JACKRABBIT_HOME}/workspaces/${WORKSPACE_NAME}/workspace.xml




>
>
>         I built a test program to exercise java.sql.DatabaseMetaData and
> the connection utility I am using looks like
>
>       try
>       {
>          String driverStr = "jdbc:db2:"+dbname;
>          Class driveClass = Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
>          con = DriverManager.getConnection(driverStr, username, pwsd);
>       }
>
> where dbname = "a2test", username = "a2test", and pwsd = "a2test".
> My test program functions properly
>
>
> e.g.
>
> /home/milhri/QueryDbMeta.java
>
> 1. ------------------------------------------
> Database product name is DB2/6000
>
>
> 2. ------------------------------------------
> schema preferred term is schema
>
>
> schemas available
> A2TEST
> NULLID
> SQLJ
> SYSCAT
> SYSFUN
> SYSIBM
> SYSPROC
> SYSSTAT
> SYSTOOLS
>
> etc.
>
>         When I attempt to run my jackrabbit program, I get
>
> /home/milhri>java -Djava.security.auth.login.config==/home/milhri/repotestdb/jaas.config JCRDbTest > testdb
>
> init >>>>>>>>>>>>org.apache.jackrabbit.core.config.ConfigurationException: Replacement not found for ${wsp.name}.
> checkRootNode >>>>>>>>>>>>java.lang.NullPointerException
> createNamespace >>>>>>>>>>>>java.lang.NullPointerException
> addContent >>>>>>>>>>>>java.lang.NullPointerException
> browseContent >>>>>>>>>>>>java.lang.NullPointerException
> browseAll >>>>>>>>>>>>java.lang.NullPointerException
>
>
>         Any ideas why the ${wsp.name} is not found?
>
> Thanks.
>
>
>
> On Thu, Dec 15, 2005 at 09:42:28PM -0300, Edgar Poce wrote:
> > Hi rick,
> >
> >  you can take a look to
> > http://incubator.apache.org/jackrabbit/apidocs/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.html,
> > it contains documentation and examples that will help you to configure your
> > jdbc connection.
> >
> > br,
> > edgar
> >
> > milhri@lidp.com wrote:
> > >First time mailer...
> > >
> > >I have successfully downloaded Apache Jackrabbit, and
> > >developed (from a variety of sources) a couple of working
> > >repositories.  Further, I haven't added anything to the standard
> > >configuration.
> > >
> > >e.g.
> > >
> > >/home/milhri
> > >    JCRTest.java
> > >    repotest
> > >    JackTest.java
> > >    repotest2
> > >
> > >/home/milhri/repotest2
> > >    jaas.config
> > >    repository
> > >    repository.xml
> > >    versions
> > >    workspaces
> > >
> > >In both cases, I am using local flat files for persistent storage.
> > >I need to demo persistent data storage in a database.
> > >
> > >Database server        = DB2/6000 8.2.1
> > >
> > >We currently use this database as persistent storage for a J2EE
> > >application.
> > >
> > >Can someone lend assistance getting a similar example program to
> > >persist data in the database above?
> > >
> > >Thanks.
> > >
> >
>
> --
>                                             Sincerely,
>
>                                                Rick Milheron
>                                                FLMI,ACS
>                                                LIDP Consulting, Inc.
>                                                Phone 630.829.7136
>                                                milhri@lidp.com
>                                                nihilum in temperantia
>

Re: Database persistent storage

Posted by mi...@lidp.com.
Edgar

	Here is where I am to date:

/home/milhri/repotestdb
	jaas.config
	repository.xml

    <Workspace name="${wsp.name}">
        <FileSystem
class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
            <param name="path" value="${wsp.home}"/>
        </FileSystem>
        <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
            <param name="driver" value="COM.ibm.db2.jdbc.app.DB2Driver"/>
            <param name="url" value="jdbc:db2:a2test"/>
            <param name="user" value="a2test"/>
            <param name="password" value="a2test"/>
            <param name="schema" value="mysql"/>
            <param name="schemaObjectPrefix" value="${wsp.name}_"/>
            <param name="externalBLOBs" value="false"/>
        </PersistenceManager>
        <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
            <param name="path" value="${wsp.home}/index"/>
        </SearchIndex>
    </Workspace>


	I built a test program to exercise java.sql.DatabaseMetaData and
the connection utility I am using looks like

      try
      {
         String driverStr = "jdbc:db2:"+dbname;
         Class driveClass = Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
         con = DriverManager.getConnection(driverStr, username, pwsd);
      }

where dbname = "a2test", username = "a2test", and pwsd = "a2test".
My test program functions properly 


e.g.

/home/milhri/QueryDbMeta.java

1. ------------------------------------------
Database product name is DB2/6000


2. ------------------------------------------
schema preferred term is schema


schemas available
A2TEST 
NULLID 
SQLJ
SYSCAT 
SYSFUN 
SYSIBM 
SYSPROC
SYSSTAT
SYSTOOLS

etc.

	When I attempt to run my jackrabbit program, I get

/home/milhri>java -Djava.security.auth.login.config==/home/milhri/repotestdb/jaas.config JCRDbTest > testdb

init >>>>>>>>>>>>org.apache.jackrabbit.core.config.ConfigurationException: Replacement not found for ${wsp.name}.
checkRootNode >>>>>>>>>>>>java.lang.NullPointerException
createNamespace >>>>>>>>>>>>java.lang.NullPointerException
addContent >>>>>>>>>>>>java.lang.NullPointerException
browseContent >>>>>>>>>>>>java.lang.NullPointerException
browseAll >>>>>>>>>>>>java.lang.NullPointerException

	
	Any ideas why the ${wsp.name} is not found?

Thanks.
	


On Thu, Dec 15, 2005 at 09:42:28PM -0300, Edgar Poce wrote:
> Hi rick,
> 
>  you can take a look to 
> http://incubator.apache.org/jackrabbit/apidocs/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.html, 
> it contains documentation and examples that will help you to configure your 
> jdbc connection.
> 
> br,
> edgar
> 
> milhri@lidp.com wrote:
> >First time mailer...
> >
> >I have successfully downloaded Apache Jackrabbit, and 
> >developed (from a variety of sources) a couple of working 
> >repositories.  Further, I haven't added anything to the standard
> >configuration.  
> >
> >e.g.
> >
> >/home/milhri
> >    JCRTest.java
> >    repotest 
> >    JackTest.java
> >    repotest2
> >
> >/home/milhri/repotest2
> >    jaas.config
> >    repository
> >    repository.xml
> >    versions
> >    workspaces
> >
> >In both cases, I am using local flat files for persistent storage.
> >I need to demo persistent data storage in a database.  
> >
> >Database server        = DB2/6000 8.2.1
> >
> >We currently use this database as persistent storage for a J2EE
> >application.
> >
> >Can someone lend assistance getting a similar example program to 
> >persist data in the database above?  
> >
> >Thanks.
> >
> 

-- 
                                            Sincerely,

                                               Rick Milheron
                                               FLMI,ACS
                                               LIDP Consulting, Inc.
                                               Phone 630.829.7136
                                               milhri@lidp.com
                                               nihilum in temperantia

Re: Database persistent storage

Posted by mi...@lidp.com.
Edgar

	Thanks and good to hear from you again.  Ok, I believe that I
can follow this.  A couple of more questions, if I may...

1.  Do I need to create a mysql.ddl file?  If so, where in my directory
structure does that file reside?  Or is it created automatically, or
exist as part of the jackrabbit download?

e.g.

./src/main/java/org/apache/jackrabbit/core/fs/db/derby.ddl
./src/main/java/org/apache/jackrabbit/core/fs/db/postgresql.ddl
./src/main/java/org/apache/jackrabbit/core/fs/db/mssql.ddl
./src/main/java/org/apache/jackrabbit/core/fs/db/mysql.ddl
./src/main/java/org/apache/jackrabbit/core/fs/db/daffodil.ddl
./src/main/java/org/apache/jackrabbit/core/fs/db/default.ddl
./src/main/java/org/apache/jackrabbit/core/state/db/derby.ddl
./src/main/java/org/apache/jackrabbit/core/state/db/postgresql.ddl
./src/main/java/org/apache/jackrabbit/core/state/db/mssql.ddl
./src/main/java/org/apache/jackrabbit/core/state/db/mysql.ddl
./src/main/java/org/apache/jackrabbit/core/state/db/daffodil.ddl
./src/main/java/org/apache/jackrabbit/core/state/db/default.ddl




2.  Will the code in my JackTest.java program

e.g.

      if (!rn.hasNode("testnode"))
      {
        System.out.println("creating testnode");
        Node n=rn.addNode("testnode", "nt:unstructured");
        n.setProperty("testprop", session.getValueFactory().createValue("Hello, World."));
        session.save();
      }

for manipulating items be sufficient?  Or do I need to use different
statements?

Thanks again for your time and effort.


On Thu, Dec 15, 2005 at 09:42:28PM -0300, Edgar Poce wrote:
> Hi rick,
> 
>  you can take a look to 
> http://incubator.apache.org/jackrabbit/apidocs/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.html, 
> it contains documentation and examples that will help you to configure your 
> jdbc connection.
> 
> br,
> edgar
> 
> milhri@lidp.com wrote:
> >First time mailer...
> >
> >I have successfully downloaded Apache Jackrabbit, and 
> >developed (from a variety of sources) a couple of working 
> >repositories.  Further, I haven't added anything to the standard
> >configuration.  
> >
> >e.g.
> >
> >/home/milhri
> >    JCRTest.java
> >    repotest 
> >    JackTest.java
> >    repotest2
> >
> >/home/milhri/repotest2
> >    jaas.config
> >    repository
> >    repository.xml
> >    versions
> >    workspaces
> >
> >In both cases, I am using local flat files for persistent storage.
> >I need to demo persistent data storage in a database.  
> >
> >Database server        = DB2/6000 8.2.1
> >
> >We currently use this database as persistent storage for a J2EE
> >application.
> >
> >Can someone lend assistance getting a similar example program to 
> >persist data in the database above?  
> >
> >Thanks.
> >
> 

-- 
                                            Sincerely,

                                               Rick Milheron
                                               FLMI,ACS
                                               LIDP Consulting, Inc.
                                               Phone 630.829.7136
                                               milhri@lidp.com
                                               nihilum in temperantia

Re: Database persistent storage

Posted by Edgar Poce <ed...@gmail.com>.
Hi rick,

  you can take a look to 
http://incubator.apache.org/jackrabbit/apidocs/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.html, 
it contains documentation and examples that will help you to configure 
your jdbc connection.

br,
edgar

milhri@lidp.com wrote:
> First time mailer...
> 
> I have successfully downloaded Apache Jackrabbit, and 
> developed (from a variety of sources) a couple of working 
> repositories.  Further, I haven't added anything to the standard
> configuration.  
> 
> e.g.
> 
> /home/milhri
>     JCRTest.java
>     repotest 
>     JackTest.java
>     repotest2
> 
> /home/milhri/repotest2
>     jaas.config
>     repository
>     repository.xml
>     versions
>     workspaces
> 
> In both cases, I am using local flat files for persistent storage.
> I need to demo persistent data storage in a database.  
> 
> Database server        = DB2/6000 8.2.1
> 
> We currently use this database as persistent storage for a J2EE
> application.
> 
> Can someone lend assistance getting a similar example program to 
> persist data in the database above?  
> 
> Thanks.
>