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

后端 未结 4 623
名媛妹妹
名媛妹妹 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:40

    yes this will be OK for meanwhile. But there are details missing. I'll post detailed instructions as soon as i get to the office. Actually there is a sample for mySql somewhere on the grails site, and from it it's pretty clear how to make same for an oracle DB.

    I just have created a new app and compared it with myne for oracle 11g. Here it is:

    1. ./build.gradle, add following line to "dependencies" section:

      runtime "com.oracle:ojdbc14:10.2.0.3.0"

    2. ./grails-app/conf/application.yml, add following to "hibernate" section:

    jdbc:
        use_get_generated_keys: true
    
    1. ./grails-app/conf/application.yml, dataSource: section should be like:
    dataSource:
        pooled: true
        jmxExport: true
        driverClassName: oracle.jdbc.OracleDriver
        username: YOURUSERNAME
        password: yoursecret
    
    1. ./grails-app/conf/application.yml, environments: configuration, all three environments should be like:
    environments:
    development:
        dataSource:
            dbCreate: create
            url: jdbc:oracle:thin:@somehost.net:1521:YOURORAINSTANCE
    test:
        dataSource:
            dbCreate: update
            url: jdbc:oracle:thin:@somehost.net:1521:YOURORAINSTANCE
    production:
        dataSource:
            dbCreate: update
            url: jdbc:oracle:thin:@somehost.net:1521:YOURORAINSTANCE
    

    And the Hibernate dialect for Oracle you have is pretty old one, I think you'd better remove it, without specifying it explicitly all works fine.

提交回复
热议问题