【问题标题】:Grails with Oracle thick OCI driver authenticate to Oracle with wrong user带有 Oracle 厚 OCI 驱动程序的 Grails 使用错误的用户向 Oracle 进行身份验证
【发布时间】:2015-01-11 15:07:12
【问题描述】:

我已经使用存储在 Oracle 钱包中的证书设置了对 Oracle 的身份验证,方法是在

中添加以下行

sqlnet.ora。 sqlnet.ora 位于我的 Linux 主目录中。

 WALLET_LOCATION =
    (SOURCE =
      (METHOD = FILE)
      (METHOD_DATA =
        (DIRECTORY = my_wallet_location)
      )
     )

 SQLNET.WALLET_OVERRIDE = TRUE

并在DataSource.groovy中设置用户名和密码为“”

 username=""
 password=""

但是,在我启动我的 grails 应用程序后,我发现我的应用程序进行了操作系统身份验证,这让我以 ops$john 的身份登录到 Oracle,就像应该是 john 一样,并且完全忽略了我的钱包设置。

请指教。

更新:

这是 DataSource.groovy 的其余部分

dataSource {
    pooled = true
    jmxExport = true
    driverClassName = "oracle.jdbc.driver.OracleDriver"
    username=""
    password=""
}
hibernate {
    cache.use_second_level_cache = true
    cache.use_query_cache = true
//    cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' // Hibernate 3
    cache.region.factory_class = 'org.hibernate.cache.ehcache.EhCacheRegionFactory' // Hibernate 4
    singleSession = true // configure OSIV singleSession mode
    flush.mode = 'manual' // OSIV session flush mode outside of transactional context
}

// environment specific settings
environments {
    development {
        dataSource {
            dbCreate = "update" // one of 'create', 'create-drop', 'update', 'validate', ''
            url = "jdbc:oracle:oci:@//myhost:myport/myinstance"
            properties {
                // See http://grails.org/doc/latest/guide/conf.html#dataSource for documentation
                jmxEnabled = true
                initialSize = 5
                maxActive = 50
                minIdle = 5
                maxIdle = 25
                maxWait = 10000
                maxAge = 10 * 60000
                timeBetweenEvictionRunsMillis = 5000
                minEvictableIdleTimeMillis = 60000
                validationQuery = "SELECT 1"
                validationQueryTimeout = 3
                validationInterval = 15000
                testOnBorrow = true
                testWhileIdle = true
                testOnReturn = false
                jdbcInterceptors = "ConnectionState"
                defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED
             }
        }
    }
}

【问题讨论】:

  • 你能分享你的 DataSource.groovy 的其余部分吗?
  • 我已经更新了原帖。
  • 尝试使用以下格式的 url:jdbc:oracle:oci:/@alias 其中 alias 是 tnsnanems.ora 文件中的钱包别名

标签: oracle security grails jdbc grails-orm


【解决方案1】:

您应该使用带有此 format: jdbc:oracle:oci:/@alias 的 URL,其中 alias 是您的 tnsnames.ora 文件中的钱包别名。

此选项记录在多个位置,例如 herehere。大多数文档都引用了瘦驱动程序,但它与 OCI 驱动程序的工作方式相同。这个post 描述了使用 OCI 驱动程序创建和使用钱包的完整过程

【讨论】:

  • 它有效。这是否记录在任何地方?你能提供一个链接吗?还是你猜到了?
  • 它被记录在几个地方。我添加了答案的链接
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多