datasource

Dynamic DataSource Routing

怎甘沉沦 提交于 2019-11-30 20:36:16
问题 Sorry for my bad English. I wrote implementation for AbstractRoutingDataSource: public class DatabaseRoutingDataSource extends AbstractRoutingDataSource{ @Override protected Object determineCurrentLookupKey() { return DatabaseContextHolder.getDatabaseType(); } } And I created new class for switching between databases: public class DatabaseContextHolder { private static final ThreadLocal<DatabaseType> contextHolder = new ThreadLocal<DatabaseType>(); public static void setDatabaseType

Produce a `DataSource` object for Postgres JDBC, programmatically

此生再无相见时 提交于 2019-11-30 20:23:34
The JDBC Tutorial recommends using a DataSource object to obtain database connections rather than using the DriverManager class. To quote the Connecting with DataSource Objects page: DataSource objects … the preferred means of getting a connection to a data source. How do I get such an object for a JDBC connection to Postgres? I have a JDBC driver in place. Right now, I do not want to fiddle around with JNDI like this or this . Can I instantiate a DataSource programmatically within my Java app? Or must I implement that DataSource interface myself? JDBC driver’s implementation Your JDBC driver

SQLNestedException: Cannot create JDBC driver

ぃ、小莉子 提交于 2019-11-30 20:06:14
用DataSource 通过JNDI取得连接问题 ,抛出如下异常: java.lang.RuntimeException: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' 原因是:部署webapp应用方式的问题,导致tomcat启动时找不到/META-INF/context.xml文件 往tomcat部署webapp应用有很多方式: 第1种方式: 这种方式最简单,就是在$CATALINA_BASE/conf/server.xml文件里做如下配置: <Context docBase="D:\java\workspace\JspServletNote\WebContent" path="/JspServletNote" reloadable="true" /> 这种方式,就能导致 tomcat启动时找不到/META-INF/context.xml文件 解决方法就是: 把自个的WebAppProject里的 /META-INF/context.xml 的内容复制到 $CATALINA_BASE/conf/context.xml里或者 $CATALINA_BASE/conf/server.xml里 参见: http:/

Grails multi datasource domain issue

此生再无相见时 提交于 2019-11-30 18:50:52
问题 I have a project which tables spread between 2 datasources. I'm configuring the code to access table as per 3.3.6 topic in grails documentations http://grails.org/doc/2.0.0.M2/guide/conf.html#dataSourcesAndEnvironments Everything seems to be ok, but I got the following error Message: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name

MySQL connection validity test in datasource : SELECT 1 or something better?

无人久伴 提交于 2019-11-30 18:41:56
I'm setting up a failover cluster on MySQL, in a master/slave architecture. I'm also configuring my JBoss Datasource, and I'm looking for the better way to test my connection, knowing that it is for Alfresco (which is using Ibatis). Even I praticed MySQL many times, I don't know very well internals mechanisms of execution in MySQL Server. So far, I'm using this query to test my SQL connection (like in this thread : Database Fail Over in Jboss Data sources ) SELECT 1; Here the full datasource. <?xml version="1.0" encoding="UTF-8"?> <datasources> <local-tx-datasource> <jndi-name>alfresco

What is the simplest, most maintainable way to create a SQL Server ODBC Data Source?

邮差的信 提交于 2019-11-30 18:18:31
问题 I need a programmatic way of creating a SQL Server ODBC Data Source. I can do this by directly accessing the Registry. It would be better if this could be done via an available (SQL Server/Windows) API to protect against changes in the registry keys or values with updated SQL Server drivers. Accepted Answer Note: Using SQLConfigDataSource abstracts the code from the details of Registry keys etc. so this is more robust. I was hoping, however, that SQL Server would have wrapped this with a

In JBoss/WildFly should I enable JTA on data source to use with JPA?

主宰稳场 提交于 2019-11-30 18:04:32
问题 In JBoss/WildFly, when configuring a data source, there is a JTA option, which is disabled by default: <datasource jta="false" jndi-name="java:/wt/testds" pool-name="testds" enabled="true" use-ccm="false"> ... </datasource> Now I want to associate this data source with JPA using JTA transaction type: <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http:/

How do I set up a connection string for a MySQL database in a C# project without using dialog boxes?

£可爱£侵袭症+ 提交于 2019-11-30 17:55:14
问题 NOTE: Apparently, the reason the MySQL connector installation doesn't show up automatically in the Dialog Boxes for adding a data source is because the Visual 2008 Express Edition doesn't allow "3rd party integration" within the Visual Studio IDE. So, this makes setting up the data source manually even more important because the integrated tools from the MySQL connector aren't present. My goal is to set up a connection to a MySQL database using Entity Framework (an ADO.NET Entity Data Model).

Xcode 7 storyboard delegate datasource scenes

那年仲夏 提交于 2019-11-30 17:49:11
After updating Xcode 7, some of my viewcontrollers' names changed to Delegate Scene, what to do about this? Thanks! Changing the title doesn't help Try renaming the controller to whatever you want it to be: Step 1 Select the "controller", named "Delegate" in your screenshot. Step 2 Click again on "Delegate", or press [Enter] to enter renaming mode. Step 3 Rename it to something meaningful. Step 4 Deselect or press [Enter] again to save the changes. The scene name will be updated to match the name you specified. Adding to @Steve Wilford Reply: In Xcode 7's story board, there is limitation on

How do I set columnNames for a dataGridView bound to a List<T>?

烈酒焚心 提交于 2019-11-30 17:39:04
问题 As shown below I have created a List of equip.I would like to have the column names more descriptive - is there an attribute that I can use in the equip.properties? DataGridView.Datasource = EquipList; List<equip> EquipList = new List<equip>(); public class equip { public int EquipID {get;set;} public string EquipName {get;set;} } Okay, maybe I didn't explain myself properly...I am hoping that that there is an attribute that could be applied like.... [Alis("name I would like to see in the