How-to: Grails 3.0.2 + Oracle Database 12c?

后端 未结 4 536
名媛妹妹
名媛妹妹 2021-01-13 13:53

I am making my first steps with Grails and try to create a hello world application with an Oracle Database 12c.

Unfortunately the tutorial documentation on the datab

4条回答
  •  执念已碎
    2021-01-13 14:46

    1. download ojdbc7.jar from http://www.oracle.com/technetwork/database/features/jdbc/jdbc-drivers-12c-download-1958347.html

    2. create a /lib folder in the main folder of your application (lib folder was removed from Grails 3)

    3. copy ojdbc7.jar to lib folder

    4. add this line to the /build.gradle file

      dependencies{
           (...)
           runtime fileTree(dir: 'lib', include: '*.jar')
           (...)
      }
    
    1. create lines in the /grails-app/conf/application.yml
     hibernate:
          (...)
          jdbc:
             use_get_generated_keys: true
    
     dataSource:
        pooled: true
        jmxExport: true
        driverClassName: oracle.jdbc.OracleDriver
        username: DBUSERNAME
        password: dbpassword
    
     environments:
         development:
             dataSource:
                 dbCreate: create
                 url: jdbc:oracle:thin:@localhost.net:1521:dbname
         test:
             dataSource:
                 dbCreate: update
                 url: jdbc:oracle:thin:@localhost.net:1521:dbname
         production:
             dataSource:
                 dbCreate: update
                 url: jdbc:oracle:thin:@locaLhost.net:1521:dbname
    

提交回复
热议问题