Grails with Powerful OCI Oracle Driver Authenticate Oracle with Wrong User
I have configured Oracle authentication using certificates stored in Oracle wallet, having the following lines in
sqlnet.ora. sqlnet.ora is in my Linux home directory.
WALLET_LOCATION =
(SOURCE =
(METHOD = FILE)
(METHOD_DATA =
(DIRECTORY = my_wallet_location)
)
)
SQLNET.WALLET_OVERRIDE = TRUE
And set the username and password to "" in DataSource.groovy
username=""
password=""
However, after I ran the grails app, I found that my app had done os authentication, which registered me with Oracle as ops $ john as intended, and ignored my wallet entirely.
Please advise.
Update:
Here is the rest of 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
}
}
}
}
source to share
You have to use a url with this format: jdbc:oracle:oci:/@alias
, where alias is the wallet alias in your file tnsnames.ora
.
This parameter is documented in several places, for example here and here . Most of the docs reference the thin driver, but it works the same with the OCI driver. This post describes the complete process of creating and using an OCI driver wallet.
source to share