使用grails连接到多个oracle数据源的问题(Issues connecting to more than one oracle datasource using grails)

系统教程 行业动态 更新时间:2024-06-14 17:02:18
使用grails连接到多个oracle数据源的问题(Issues connecting to more than one oracle datasource using grails)

如果这是重复,请原谅我。 我搜索和搜索过。 但是在过去的几天里,我有些事情一直困扰着我。 我研究过并没有找到解决我问题的解决方案。 我正在开发一个需要访问多个数据库的应用程序。 如果我只使用一个数据库并将其注入到具有数据源对象的代码中,那么它对我使用的任何数据库都可以。 但是如果我尝试添加另一个数据源,就会出现问题。 我已经尝试将配置添加到datasource.groovy,我尝试'硬编码'连接。

硬编码方法

正如您所看到的,我尝试使用下面的各种方法,所有人都给了我错误。 ojdbc6.jar正确加载,因为我已经通过故意拼写错误拼写驱动程序类名称并获得了类找不到错误。

import java.sql.* def index(){ ... def db = [url:'jdbc:oracle:oci8:@someotherdatabase.whatever.com', user:'other_user', password:'other_pw', driver:'oracle.jdbc.OracleDriver'] def sql = Sql.newInstance(db.url, db.user, db.password, db.driver) // Sql.loadDriver("oracle.jdbc.driver.OracleDriver") // Sql.loadDriver("oracle.jdbc.OracleDriver") // def sql2 = Sql.newInstance('jdbc:oracle:oci8:@someotherdatabase.whatever.com','other_user','other_pw','oracle.jdbc.driver.OracleDriver') // def sql = Sql.newInstance("jdbc:oracle:oci8:@someotherdatabase.whatever.com", "other_user", "other_pw", "oracle.jdbc.OracleDriver") // DriverManager.registerDriver(new oracle.jdbc.OracleDriver()) // Class.forName("oracle.jdbc.driver.OracleDriver") // Connection conn = DriverManager.getConnection('jdbc:oracle:oci8:@someotherdatabase.whatever.com','other_user','other_pw') // Sql sql = new Sql(conn) ... }

错误:

Error | 2014-10-28 11:38:06,766 [http-bio-8080-exec-1] ERROR errors.GrailsExceptionResolver - SQLException occurred when processing request: [GET] /ApplicationPortal/home No suitable driver found for jdbc:oracle:oci8:@someotherdatabase.whatever.com. Stacktrace follows: Message: No suitable driver found for jdbc:oracle:oci8:@someotherdatabase.whatever.com Line | Method ->> 602 | getConnection in java.sql.DriverManager - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 185 | getConnection in '' | 192 | index . . . . in com.myapp.HomeController$$EOu0LeDV | 200 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter | 63 | doFilter . . in grails.plugin.cache.web.filter.AbstractFilter | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run . . . . . in '' ^ 662 | run in java.lang.Thread

Datasource.groovy配置方法

我在datasource.groovy中尝试了不同的配置。 目前这是它的样子:

dataSource { dialect = org.hibernate.dialect.Oracle10gDialect driverClassName = 'oracle.jdbc.driver.OracleDriver' pooled = true properties { maxActive = -1 minEvictableIdleTimeMillis=1800000 timeBetweenEvictionRunsMillis=1800000 numTestsPerEvictionRun=3 testOnBorrow=true testWhileIdle=true testOnReturn=true validationQuery="SELECT 1 from dual" } } hibernate { cache.use_second_level_cache = true cache.use_query_cache = false cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' showsql = true } environments { development { dataSource { url = "jdbc:oracle:oci:@database.whatever.com" username="data_user" password = "some_pw" } dataSource_task { url = "jdbc:oracle:oci8:@someotherdatabase.whatever.com" username="other_user" password = "other_pw" } } }

我收到了错误。 我不知道为什么它试图使用h2数据库。 我需要它连接到oracle数据库。

Error | 2014-10-29 13:30:53,500 [localhost-startStop-1] ERROR pool.ConnectionPool - Unable to create initial connections of pool. Message: Driver:org.h2.Driver@42b1b290 returned null for URL:jdbc:oracle:oci8:@someotherdatabase.whatever.com Line | Method ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Error | 2014-10-29 13:30:53,547 [localhost-startStop-1] ERROR pool.ConnectionPool - Unable to create initial connections of pool. Message: Driver:org.h2.Driver@2d2c1472 returned null for URL:jdbc:oracle:oci8:@someotherdatabase.whatever.com Line | Method ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Error | 2014-10-29 13:30:53,621 [localhost-startStop-1] ERROR pool.ConnectionPool - Unable to create initial connections of pool. Message: Driver:org.h2.Driver@17898b92 returned null for URL:jdbc:oracle:oci8:@someotherdatabase.whatever.com Line | Method ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Error | 2014-10-29 13:30:53,634 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing the application: Error creating bean with name 'transactionManager_task': Cannot resolve reference to bean 'sessionFactory_task' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory_task': Cannot resolve reference to bean 'hibernateProperties_task' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties_task': Cannot resolve reference to bean 'dialectDetector_task' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector_task': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: Driver:org.h2.Driver@17898b92 returned null for URL:jdbc:oracle:oci8:@someotherdatabase.whatever.com Message: Error creating bean with name 'transactionManager_task': Cannot resolve reference to bean 'sessionFactory_task' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory_task': Cannot resolve reference to bean 'hibernateProperties_task' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties_task': Cannot resolve reference to bean 'dialectDetector_task' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector_task': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: Driver:org.h2.Driver@17898b92 returned null for URL:jdbc:oracle:oci8:@someotherdatabase.whatever.com Line | Method ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Caused by BeanCreationException: Error creating bean with name 'sessionFactory_task': Cannot resolve reference to bean 'hibernateProperties_task' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties_task': Cannot resolve reference to bean 'dialectDetector_task' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector_task': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: Driver:org.h2.Driver@17898b92 returned null for URL:jdbc:oracle:oci8:@someotherdatabase.whatever.com ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Caused by BeanCreationException: Error creating bean with name 'hibernateProperties_task': Cannot resolve reference to bean 'dialectDetector_task' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector_task': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: Driver:org.h2.Driver@17898b92 returned null for URL:jdbc:oracle:oci8:@someotherdatabase.whatever.com ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Caused by BeanCreationException: Error creating bean with name 'dialectDetector_task': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: Driver:org.h2.Driver@17898b92 returned null for URL:jdbc:oracle:oci8:@someotherdatabase.whatever.com ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Caused by MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: Driver:org.h2.Driver@17898b92 returned null for URL:jdbc:oracle:oci8:@someotherdatabase.whatever.com ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Caused by SQLException: Driver:org.h2.Driver@17898b92 returned null for URL:jdbc:oracle:oci8:@someotherdatabase.whatever.com ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Error | Forked Grails VM exited with error

设置:Grails 2.3.7 Oracle 11g

编辑:数据源方法的问题不在于我使用了多少数据源。 我和这个名字有关系。 如果我只使用一个datasouce作为datasource_other,它将抛出错误。 但数据源有效。

If this is a duplicate, please forgive me. I have searched and searched. But I have something that's been bugging me for the past couple of days. I have researched and haven't found a solution that solves my issues. I'm working on an application that will need to access multiple databases. If I do just one database and inject it into the code with a datasource object, it does just fine with whatever database I use. But if I try to add another datasource, that's when the problems start. I have tried adding the configuration to datasource.groovy and I've tried 'hardcoding' the connection.

Hardcode method

As you can see, I've tried using the various methods below and ALL have given me the error following. The ojdbc6.jar loads correctly, because I have verified by deliberately misspelling the driver class name and got the class not found error.

import java.sql.* def index(){ ... def db = [url:'jdbc:oracle:oci8:@someotherdatabase.whatever.com', user:'other_user', password:'other_pw', driver:'oracle.jdbc.OracleDriver'] def sql = Sql.newInstance(db.url, db.user, db.password, db.driver) // Sql.loadDriver("oracle.jdbc.driver.OracleDriver") // Sql.loadDriver("oracle.jdbc.OracleDriver") // def sql2 = Sql.newInstance('jdbc:oracle:oci8:@someotherdatabase.whatever.com','other_user','other_pw','oracle.jdbc.driver.OracleDriver') // def sql = Sql.newInstance("jdbc:oracle:oci8:@someotherdatabase.whatever.com", "other_user", "other_pw", "oracle.jdbc.OracleDriver") // DriverManager.registerDriver(new oracle.jdbc.OracleDriver()) // Class.forName("oracle.jdbc.driver.OracleDriver") // Connection conn = DriverManager.getConnection('jdbc:oracle:oci8:@someotherdatabase.whatever.com','other_user','other_pw') // Sql sql = new Sql(conn) ... }

error:

Error | 2014-10-28 11:38:06,766 [http-bio-8080-exec-1] ERROR errors.GrailsExceptionResolver - SQLException occurred when processing request: [GET] /ApplicationPortal/home No suitable driver found for jdbc:oracle:oci8:@someotherdatabase.whatever.com. Stacktrace follows: Message: No suitable driver found for jdbc:oracle:oci8:@someotherdatabase.whatever.com Line | Method ->> 602 | getConnection in java.sql.DriverManager - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 185 | getConnection in '' | 192 | index . . . . in com.myapp.HomeController$$EOu0LeDV | 200 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter | 63 | doFilter . . in grails.plugin.cache.web.filter.AbstractFilter | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run . . . . . in '' ^ 662 | run in java.lang.Thread

Datasource.groovy configuration method

I have tried different configurations in datasource.groovy. Currently this is what it looks like:

dataSource { dialect = org.hibernate.dialect.Oracle10gDialect driverClassName = 'oracle.jdbc.driver.OracleDriver' pooled = true properties { maxActive = -1 minEvictableIdleTimeMillis=1800000 timeBetweenEvictionRunsMillis=1800000 numTestsPerEvictionRun=3 testOnBorrow=true testWhileIdle=true testOnReturn=true validationQuery="SELECT 1 from dual" } } hibernate { cache.use_second_level_cache = true cache.use_query_cache = false cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' showsql = true } environments { development { dataSource { url = "jdbc:oracle:oci:@database.whatever.com" username="data_user" password = "some_pw" } dataSource_task { url = "jdbc:oracle:oci8:@someotherdatabase.whatever.com" username="other_user" password = "other_pw" } } }

And I'm getting the error. I don't know why it's trying to use the h2 database. I need it to connect to the oracle database.

Error | 2014-10-29 13:30:53,500 [localhost-startStop-1] ERROR pool.ConnectionPool - Unable to create initial connections of pool. Message: Driver:org.h2.Driver@42b1b290 returned null for URL:jdbc:oracle:oci8:@someotherdatabase.whatever.com Line | Method ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Error | 2014-10-29 13:30:53,547 [localhost-startStop-1] ERROR pool.ConnectionPool - Unable to create initial connections of pool. Message: Driver:org.h2.Driver@2d2c1472 returned null for URL:jdbc:oracle:oci8:@someotherdatabase.whatever.com Line | Method ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Error | 2014-10-29 13:30:53,621 [localhost-startStop-1] ERROR pool.ConnectionPool - Unable to create initial connections of pool. Message: Driver:org.h2.Driver@17898b92 returned null for URL:jdbc:oracle:oci8:@someotherdatabase.whatever.com Line | Method ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Error | 2014-10-29 13:30:53,634 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing the application: Error creating bean with name 'transactionManager_task': Cannot resolve reference to bean 'sessionFactory_task' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory_task': Cannot resolve reference to bean 'hibernateProperties_task' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties_task': Cannot resolve reference to bean 'dialectDetector_task' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector_task': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: Driver:org.h2.Driver@17898b92 returned null for URL:jdbc:oracle:oci8:@someotherdatabase.whatever.com Message: Error creating bean with name 'transactionManager_task': Cannot resolve reference to bean 'sessionFactory_task' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory_task': Cannot resolve reference to bean 'hibernateProperties_task' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties_task': Cannot resolve reference to bean 'dialectDetector_task' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector_task': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: Driver:org.h2.Driver@17898b92 returned null for URL:jdbc:oracle:oci8:@someotherdatabase.whatever.com Line | Method ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Caused by BeanCreationException: Error creating bean with name 'sessionFactory_task': Cannot resolve reference to bean 'hibernateProperties_task' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties_task': Cannot resolve reference to bean 'dialectDetector_task' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector_task': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: Driver:org.h2.Driver@17898b92 returned null for URL:jdbc:oracle:oci8:@someotherdatabase.whatever.com ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Caused by BeanCreationException: Error creating bean with name 'hibernateProperties_task': Cannot resolve reference to bean 'dialectDetector_task' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector_task': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: Driver:org.h2.Driver@17898b92 returned null for URL:jdbc:oracle:oci8:@someotherdatabase.whatever.com ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Caused by BeanCreationException: Error creating bean with name 'dialectDetector_task': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: Driver:org.h2.Driver@17898b92 returned null for URL:jdbc:oracle:oci8:@someotherdatabase.whatever.com ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Caused by MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: Driver:org.h2.Driver@17898b92 returned null for URL:jdbc:oracle:oci8:@someotherdatabase.whatever.com ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Caused by SQLException: Driver:org.h2.Driver@17898b92 returned null for URL:jdbc:oracle:oci8:@someotherdatabase.whatever.com ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Error | Forked Grails VM exited with error

Setup: Grails 2.3.7 Oracle 11g

EDIT: The problem with the datasource method is not with how many datasources I use. I has to do with the name. If I just use one datasouce as datasource_other, it will throw the error. But datasource works.

最满意答案

就数据源配置方法而言,我想到了一个。 这是一个愚蠢的错误。 我没有将driverClassName添加到dataSource_task。

dataSource_task { url = "jdbc:oracle:oci8:@someotherdatabase.whatever.com" username="other_user" password = "other_pw" driverClassName = 'oracle.jdbc.driver.OracleDriver'// <- it needed this }

我仍然想知道为什么硬编码方法不起作用。

As far as the datasource configuration method is concerned, I figured that one. It was a boneheaded mistake. I didn't add the driverClassName to the dataSource_task.

dataSource_task { url = "jdbc:oracle:oci8:@someotherdatabase.whatever.com" username="other_user" password = "other_pw" driverClassName = 'oracle.jdbc.driver.OracleDriver'// <- it needed this }

I'd still like to know why the hardcode method doesn't work tho.

更多推荐

本文发布于:2023-04-21 18:48:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/517b46da43f07b40234ec404e2de6ddd.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:多个   数据源   连接到   grails   oracle

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!