Announcement Announcement Module
Collapse
No announcement yet.
Oracle db Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Oracle db

    For persistence I first used
    Code:
    persistence setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY
    I then (later on the same project) entered
    Code:
    persistence setup  --provider HIBERNATE --database ORACLE
    Roo then creating the following POM dependency
    Code:
    <dependency>
                <groupId>com.oracle</groupId>
                <artifactId>ojdbc14</artifactId>
                <version>10.2.0.2</version>
            </dependency>
    Is the Oracle version is hard coded to 10.2.0.2? (If not where can I adjust it?) If so and if it doesn't match our version then the POM has to be edited. Wouldn't it be better to have some parameters on the persisence setup to direct Roo to use the correct version?

  • #2
    We have chosen the current up-to-date version of the Oracle driver. If you need a different version please change this in the pom.xml file which should be easy. There are also the dependency add and dependency remove commands which can assist you.

    HTH,
    Stefan

    Comment


    • #3
      If you are using 11g, update your dependency accordingly

      Comment


      • #4
        Originally posted by Alan Stewart View Post
        If you are using 11g, update your dependency accordingly
        Hi, after I had tested Roo+Oracle back in March this year, and having posted my experiences in this forum and in Jira, I now am still confronted with the same problems, which I could not solve this time. Last time it has just been about correcting the jdbc-url in database.properties and about modifying the Oracle jdbc dependency in pom.xml. This time the same changes seem not to suffice. Even with these two manipulations/corrections I get:

        "The ORACLE JDBC driver is not available in public maven repositories. Please adjust the pom.xml dependency to suit your needs."

        To be concrete: I have replaced the dependency with the one found in the spring bundle repository.

        I am using 11g, but be sure, this cannot be the problem, the 10g jdbc drivers are compatible with 11g, this is tested in many projects I am involved with.

        It is very pitty, that such a petty issue, seems to slow down so many people who want to evaluate Roo with Oracle and regularly come and write in this forum about what seems to be the same issue again and again. So please, write down a step-by-step tutorial, about successfully connecting Roo to Oracle.

        If there is a thread here, containing such a "tutorial" please point me to it, I have just not found one.

        Thanks in advance,

        Xenofon

        P.S. I very much am excited about Roo and am eager to use it for Oracle based projects

        Comment


        • #5
          It would be a simple matter for me to change the dependency to

          Code:
          		<dependency>
          			<groupId>com.oracle.jdbc</groupId>
          			<artifactId>com.springsource.oracle.jdbc</artifactId>
          			<version>10.2.0.2</version>
          		</dependency>
          So that you don't have to run the mvn install command to place the jar from your Oracle distribution into your maven repo

          If a user wanted a different Oracle driver such as a specific 11g version, then they could replace their dependency with the version of their choice. At least, the above dependency would be downloaded automatically.

          Raise a Jira improvement request
          Alan

          Comment


          • #6
            As I have tried to describe, just changing the dependency in pom.xml did not help this time.
            Concerning mvn install. Do you mean to say, Roo+Oracle will only work properly if I setup my own repository?...

            Comment


            • #7
              What exactly are the error messages you see? Please elaborate. There are many Roo users who have Oracle as their db and it works for them. For Roo-generated projects, any version of the Oracle driver will work. All that is required is for the dependency in the pom to be present. If you don't want to use the Spring bundled version I listed above you will have to get one of Oracle's own drivers that come with your Oracle distribution. Oracle does not have a maven repository where the driver can be installed from so you will see the error when you run the mvn clean install command. You can copy and paste the suggested command on the command line and it will install the driver to your own local maven repo. Once installed in your local repo, you won't have to install it again. It would like something like this:
              Code:
              mvn install:install-file -DgroupId=oracle.jdbc.driver -DartifactId=ojdbc14 -Dversion=10.2.0.4.0 -Dpackaging=jar -DgeneratePom=true -Dfile=ojdbc14.jar

              Comment


              • #8
                Spring Roo - JSF project with Oracle back end

                Originally posted by Alan Stewart View Post
                What exactly are the error messages you see? Please elaborate. There are many Roo users who have Oracle as their db and it works for them. For Roo-generated projects, any version of the Oracle driver will work. All that is required is for the dependency in the pom to be present. If you don't want to use the Spring bundled version I listed above you will have to get one of Oracle's own drivers that come with your Oracle distribution. Oracle does not have a maven repository where the driver can be installed from so you will see the error when you run the mvn clean install command. You can copy and paste the suggested command on the command line and it will install the driver to your own local maven repo. Once installed in your local repo, you won't have to install it again. It would like something like this:
                Code:
                mvn install:install-file -DgroupId=oracle.jdbc.driver -DartifactId=ojdbc14 -Dversion=10.2.0.4.0 -Dpackaging=jar -DgeneratePom=true -Dfile=ojdbc14.jar
                I have created a Spring Roo project with JSF. I used Oracle as backend.
                The steps that I followed are as follows:
                =============================
                1) Created a new Spring Roo Project using Springsource Tool Suite[STS]
                2) Run the following Roo shell commands

                persistence setup --database ORACLE --provider HIBERNATE


                ================================================== ========
                ADDITIONAL WORK DONE
                ----------------------------------------
                1)Downloaded "ojdbc14.jar" from http://www.java2s.com/Code/Jar/o/Dow...1410202jar.htm[Oracle demands for Licence]

                2)Unzip the downloaded file and put it in /root/

                3)Run the following command from System Console as root user
                mvn install:install-file -DgroupId=oracle.jdbc.driver -DartifactId=ojdbc14 -Dversion=10.2.0.2 -Dpackaging=jar -DgeneratePom=true -Dfile=ojdbc14.jar

                4)Copy the ojdbc14.jar into /root/.m2/repository/oracle/jdbc/driver/ojdbc14/10.2.0.4.0/

                5)Updated the pom.xml file.
                <dependency>
                <groupId>oracle.jdbc.driver</groupId>
                <artifactId>ojdbc14</artifactId>
                <version>10.2.0.2</version>
                </dependency>

                6)Updated persistence.xml
                Replace "create" by "update"

                <property name="hibernate.hbm2ddl.auto" value="update"/>
                ================================================== ==========

                database properties list
                database properties set --key database.url --value jdbc:oracle:thin:@localhost:1521:SID
                database properties set --key database.username --value user
                database properties set --key database.password --value pass
                entity jpa --class ~.domain.users
                field string --fieldName firstName --notNull true ---sizeMin 5
                field string --fieldName lastName
                field string --fieldName designation --notNull true ---sizeMin 5
                field string --fieldName email --regexp "[a-zA-Z0-9]+@[a-zA-Z0-9]+\.[a-zA-Z0-9]+"
                field string --fieldName userId --notNull true ---sizeMin 5
                web jsf setup --implementation APACHE_MYFACES --library PRIMEFACES --theme ROCKET
                web jsf all --package ~.jsf
                perform tests
                perform package

                By running these Roo Shell Commands you will get a new project with Oracle back end. Also we can Test and take the Backup of project as a war file by last two commands.

                I used Apache-Tomcat7 for running this project.

                Note that the DB Table will automatically created with the name USERS [this is the entity we used]

                Comment


                • #9
                  You don't need #4 - that's what mvn install:install-file plugin goal does.

                  XXX 4)Copy the ojdbc14.jar into /root/.m2/repository/oracle/jdbc/driver/ojdbc14/10.2.0.4.0/

                  Is your Oracle SID actually called SID? Normally it's something like ORCL
                  ??? database properties set --key database.url --value jdbc:oracle:thin:@localhost:1521:SID

                  Comment


                  • #10
                    When I used "mvn install:install-file -", I got the error " ojdbc14.jar is not in the location /root/.m2/repository/oracle/jdbc/driver/ojdbc14/10.2.0.4.0/ ".So I copied "ojdbc14.jar" into mentioned place. Then it was ok.


                    SID means ORCL or DB Name.

                    Comment

                    Working...
                    X