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

  • Spring Roo - Oracle Connectivity

    Hi,

    I am very new to Java / Spring /Roo.

    I have been seriously considering Roo for one of my projects.

    I am developing a Web application for one of my clients, who requires Oracle as a back-end database. After successfully trying out a few tutorials and examples with HyperSonic Db (the embedded database that all the examples were using), I decided to develop a simple contactManager example to connect to Oracle Xpress Edition.

    I am facing persistent problems to connect to the Oracle Database.

    My setup is as follows:

    Windows XP
    Eclipse 3.5
    Spring Tool Suite 2.3.2
    Spring Roo 1.0.2
    Maven 2.2.1
    Oracle XE 10g (10.2.0.2)
    Ojdbc 10.2.0.2 (successfully installed using mvn install command)

    After, building the Roo application, when I run the application the Web application comes up (I am creating a simple contactManager with Person and Address domains)

    When I click on any action that has to connect to the database I get an error message

    Data access failure
    Sorry, a problem occurred while accessing the database.

    I have attached the Stack Trace.

    Exception Message
    org.hibernate.exception.GenericJDBCException: Cannot open connection; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Cannot open connection


    I need urgent help. If the information provided is not sufficient, I can provide more details. But please look into the problem and kindly guide me, where I am getting it wrong.

  • #2
    Post the FULL stacktrace, the one in the attached txt file isn't complete.

    Comment


    • #3
      Oracle Connectivity with Spring Roo

      Finally, I have solved the problem of Oracle connectivity from Spring Roo.

      Now, I am able to connect to Oracle using Spring Roo and I am able to perform round-trip actions, like create entities and fields in the database, add new fields, then regenerate the app and see the results.

      What did I do (differently)?

      I started from the beginning, creating a Spring Roo project using Eclipse 3.5, then following the steps to create just one entity.

      When I performed the tests, Roo reported that one of the dependency ojdbc14.jar was not configured. Roo indicated to download the ojdbc14.jar manually and install it.

      I used the following command, suggested by Roo
      mvn install:install-file -Dfile=ojdbc14.jar -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.2 -Dpackaging=jar

      After this, the pom.xml had the dependency looking like this:

      <dependency>
      <groupId>com.oracle</groupId>
      <artifactId>ojdbc14</artifactId>
      <version>10.2.0.2</version>
      </dependency>

      I then traversed to the database.properties [under src/main/java/resources/META-INF/spring] and edited the values, so it looked like this:

      database.password=sql
      database.url=jdbc\:oracle\:thin\:@localhost\:1521\ :XE
      database.username=dcddba
      database.driverClassName=oracle.jdbc.OracleDriver

      Finally, I created the controller and ran the application.

      I was able to connect to Oracle and when I entered data and saved, I verified it was saving it perfectly. More importantly, when I changed the entity and added new fields using Roo, recompiled and saw that the database was properly updated. This is really wonderful.

      I hope this helps newbies like me who wish to use Roo and Oracle in their very first project.

      Goo luck.

      Comment

      Working...
      X