Announcement Announcement Module
Collapse
No announcement yet.
How to use Derby Client with Roo DBRE? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to use Derby Client with Roo DBRE?

    I'm trying to DBRE a Derby database, running as a network server.
    1. persistence setup --provider ECLIPSELINK --database DERBY
    2. database reverse engineer --schema gruman. This fails because no Derby available
    3. addon install id --searchResultId 01. This installs Derby Embedded.
    4. database introspect --schema gruman. This fails, because there is no schema called gruman.

    Using autocomplete, I see all the stock Derby schemas, but it's apparently an embedded in memory empty DB. I have my persistence.xml file with my connection info, but the Derby Embedded stuff seems to be ignoring it.

    Is there a way to use the Derby Client for this?
    Last edited by dsp; Aug 5th, 2011, 08:13 PM.

  • #2
    solution
    1. Create an empty directory, navigate into it and start a Roo Shell.
    2. addon create wrapper --topLevelPackage org.springframework.roo.wrapping.derbyclient --groupId org.apache.derby --artifactId derbyclient --version 10.8.1.2 --vendorName Apache --description "#jdbcdriver driverclass:org.apache.derby.jdbc.ClientDriver" --licenseUrl http://www.apache.org
    3. Edit pom to include <Import-Package>!com.ibm.jvm,*</Import-Package> in the maven-bundle-plugin <instructions> section.
    4. mvn install
    5. osgi start --url /path/to/wrapper.jar
    6. edit database.properties (created by persistence setup) to use correct configuration and org.apache.derby.jdbc.ClientDriver

    After this, I can database introspect and database reverse engineer successfully.

    Step 2 is necessary to remove an unsatisfiable dependency in the generated manifest.

    Step 5 will permanently install the wrapper into your current copy of Roo. If you upgrade, you need to perform osgi start again. If you need to uninstall it, osgi uninstall --bundleSymbolicName org.springframerwork.roo.wrapper.derbyclient.derby client
    Last edited by dsp; Aug 5th, 2011, 01:12 PM.

    Comment


    • #3
      There is no need to wrap the Derby jar yourself as we already provide a wrapped jar in our repo. You will be prompted to install the jar when either the database introspect or reverse engineer command is first run.

      Comment


      • #4
        The only version I was offered was the derby embedded version, and there's only one DERBY database type in persistence setup (which picks the embedded driver for database.properties) so I couldn't pick one or the other. If you use the embedded driver, it doesn't recognize and connect to a network URL, and the Client Driver isn't included with the embedded jar. What did I miss? In my first post, you can see the steps I took and the results.

        Comment


        • #5
          Yes, we only wrapped the embedded version. You were correct to wrap your own version.

          Comment


          • #6
            Hypersonic has a regular and an IN_MEMORY option, can Roo do that for Derby as well?

            Comment


            • #7
              The difference is in the connection url for hsqldb, so if you provide this for Derby, I can add it. Please raise an improvement request.

              Comment


              • #8
                [Spring JIRA] Created: (ROO-2625) Support Derby Client for persistence and dbre

                Comment


                • #9
                  Here's the URL in case anyone wants to view or vote on that ticket: https://jira.springsource.org/browse/ROO-2625

                  Comment

                  Working...
                  X