datasource

configure Grails app to use JDBC connection pool

坚强是说给别人听的谎言 提交于 2019-11-29 02:04:43
This article suggests Tomcat 7 apps should use a JDBC connection pool instead of a commons-dbcp connection pool. However, the latter is the default for a Grails app, and it's not obvious how to change it. My guess is that I need to define a Spring bean in resources.groovy that overrides a bean that is normally created by default, but I've no idea what this bean should be named or what properties I need to set. The easiest thing to do would probably be to use the jdbc-pool plugin. Since the configuration options for this pool are intentionally very similar to Commons DBCP (they're documented

Grails GORM domain association across two datasources

好久不见. 提交于 2019-11-28 23:49:58
Is it possible to have an association between two domain classes (i.e. belongsTo ) if the other domain class uses a different datasource? The two datasources are different database drivers too. I suspect this may not be possible, but I wanted to reach out to the community here to see if it was possible. Right now I'm trying to do it and I am getting the usual suspected Hibernate error: Invocation of init method failed; nested exception is org.hibernate.MappingException: An association from the table domain_class_A refers to an unmapped class: DomainClassB Sample: class DomainClassA { static

VB.NET: Clear DataGridView

守給你的承諾、 提交于 2019-11-28 22:31:39
问题 I've tried - DataGridView1.DataSource=Nothing and DataGridView1.DataSource=Nothing DataGridView1.Refresh() and DataGridView1.RefreshEdit() None of them works.. I've written a method that sets the DataSource of the DataGridView when executed. but each time i execute it, it replicates the data with new value and appends it to the previous contents of the DGV.. I wanna clear the content and then add the values.. Is that possible? 回答1: If the DataGridView is bound to any datasource, you'll have

Grails 2 multiple dynamic datasources in services

六眼飞鱼酱① 提交于 2019-11-28 21:32:47
I am working on a Grails application where I must access several datasources. The datasources are defined in the default database (ie. they are stored there and I must make a call to the default database to retrieve a list of the datasource names I must prepare to connect to). When the server boots up I retrieve the list of databases, create the datasource beans and inject them. All dynamically added databases are structurally identical (ie. have the same table and domain object structure). This question is the closest I got to a useful piece of code, but it's not quite what I need. Issue #1

spring boot autoconfiguration with jdbc template autowiring dataSource issue

て烟熏妆下的殇ゞ 提交于 2019-11-28 20:41:03
I'm new to Spring and to J2EE in general. I'm having trouble using JDBC template with Spring Boot autoconfiguration. What I did was I took the example of RESTful web service provided here and decided to extend it to use JDBC template relational database access. Unfortunately another example provided cannot be useful because the only difficulty which is providing dataSource from xml beans file is not considered. What I tried to solve the issue: Using DAO Impl class as extend of different implementations from Spring. Adding to beans file. Using different DataSource classes (eg

Easy way to start a standalone JNDI server (and register some resources)

筅森魡賤 提交于 2019-11-28 19:50:48
For testing purposes, I'm looking for a simple way to start a standalone JNDI server, and bind my javax.sql.DataSource to "java:/comp/env/jdbc/mydatasource" programmatically. The server should bind itself to some URL, for example: "java.naming.provider.url=jnp://localhost:1099" (doesn't have to be JNP), so that I can look up my datasource from another process. I don't care about which JNDI server implementation I'll have to use (but I don't want to start a full-blown JavaEE server). This should be so easy, but to my surprise, I couldn't find any (working) tutorial. The JDK contains a JNDI

java.lang.ClassNotFoundException: org.apache.tomcat.jdbc.pool DataSourceFactory

半世苍凉 提交于 2019-11-28 19:40:39
I'm investigating moving away from an Oracle connection pool and using the Tomcat connection pool. I followed the myriad of example for configuring the <Resource> in Tomcat's /conf/server.xml . I found great info here . However, when I start Tomcat, I get the following error: javax.naming.NamingException: Could not load resource factory class [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.jdbc.pool DataSourceFactory] I'm using Tomcat 6.0. My <Resource> config in /conf/server.xml is: <Resource name="jdbc/myds" type="javax.sql.DataSource" auth="Container" factory="org

How to programatically change databases in Spring with one DataSource?

蓝咒 提交于 2019-11-28 18:57:32
I'm looking to see what's the best way to use one DataSources in Spring but be able to switch the database from within the Java code? Below are my two DataSources and they go to the same database server but different databases. <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.sybase.jdbc3.jdbc.SybDataSource" /> <property name="url" value="jdbc:sybase:Tds:10.20.30.40:50/DATABASE_EMS" /> <property name="username" value="userid" /> <property name="password" value="derp" /> </bean> <bean id="dataSourceMain"

Separating Data Source to another class in Swift

依然范特西╮ 提交于 2019-11-28 18:46:26
I'm trying to keep my view controllers clean as described in this article objc.io Issue #1 Lighter View Controllers . I tested this method in Objective-C and it works fine. I have a separate class which implements UITableViewDataSource methods. #import "TableDataSource.h" @interface TableDataSource() @property (nonatomic, strong) NSArray *items; @property (nonatomic, strong) NSString *cellIdentifier; @end @implementation TableDataSource - (id)initWithItems:(NSArray *)items cellIdentifier:(NSString *)cellIdentifier { self = [super init]; if (self) { self.items = items; self.cellIdentifier =

Ubuntu Tomcat7 java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory

南楼画角 提交于 2019-11-28 17:52:04
I'm trying to set up a JDBC DataSource in Tomcat 7 under Ubuntu 12.X, so I added the following to the context.xml file: <Resource name="jdbc/myDS" auth="Container" type="javax.sql.DataSource" maxActive="5" maxIdle="2" maxWait="5000" driverClassName="org.postgresql.Driver" username="usr" password="***" url="jdbc:postgresql://localhost:5432/db" /> Obviously, using the right and tested database user id and password. When I restart Tomcat, I get the this error: Feb 05, 2013 1:10:01 PM org.apache.catalina.core.NamingContextListener addResource WARNING: Failed to register in JMX: javax.naming