datasource

Should I close JNDI-obtained data source?

浪子不回头ぞ 提交于 2019-12-01 03:58:39
Update: Apparently Tomcat, starting with 7.0.11, closes the DataSource for you, so it's not available in the webapp's contextDestroyed. See: https://issues.apache.org/bugzilla/show_bug.cgi?id=25060 Hi, I'm using Spring 3.0 and Java 1.6. If I get a data source this way: <bean id="dataSource" class="my.data.Source" destroy-method="close"> <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/> <property name="url" value="jdbc:oracle:thin:@localhost:1521:home"/> <property name="username" value="user"/> <property name="password" value="pw"/> </bean> then the data source is

Unable to access weblogic datasource from java with prefix jdbc/

十年热恋 提交于 2019-12-01 03:33:02
I have created two datasource in weblogic with below jndi names jdbc/testDatasource testDatasource1 I am able to access datasource testDatasource1 using java but while access dataource jdbc/testDatasource i am getting below mention error javax.naming.NameNotFoundException: While trying to lookup 'jdbc.testDatasource' didn't find subcontext 'jdbc'. Resolved '' [Root exception is javax.naming.NameNotFoundException: While trying to lookup 'jdbc.testDatasource' didn't find subcontext 'jdbc'. Resolved '']; remaining name 'jdbc/testDatasource' it seem that prefix jdbc/ is giving problem. In some

Spring Datasource and Database Schema

本小妞迷上赌 提交于 2019-12-01 03:24:16
问题 I am trying to declare a Spring datasource pointing to a DB2 database. Presently I am using a org.springframework.jdbc.datasource.DriverManagerDataSource to setup the connection but am not finding any way to specify the database schema in the database in the datasource bean. Could anyone help me on this? 回答1: Problem is there is no standard way to set the schema, each database has a different mechanism. A work around is to set the schema as part of the db url... For db2 the url will look

HikariPool-1 - Connection is not available, request timed out after 30000ms for very tiny load server

戏子无情 提交于 2019-12-01 02:20:21
I have a small Java application for testing purposes. I have moved to hikari recently. What I notice is that I keep getting this error. java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30000ms. java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30000ms. at com.zaxxer.hikari.pool.HikariPool.createTimeoutException(HikariPool.java:602) at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:195) at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:145)

DataGridViewColumn.DataPropertyName Property

血红的双手。 提交于 2019-12-01 01:12:07
问题 I have a DataGridView control and I want to populate it with data. I use DataSource property // dgvDealAsset is DataGridView private void DealAssetListControl_Load(object sender, EventArgs e) { dgvDealAssets.AutoGenerateColumns = false; dgvDealAssets.DataSource = DealAssetList.Instance.Values.ToList(); } Now problem number one. The class of my collection does not contain only simple types that I can map to columns using DataPropertyName. This is the class that is contained in collection.

Run SQL statement at beginning of each DB connection in Spring Boot

大憨熊 提交于 2019-12-01 00:29:07
How can I run a custom SQL statement directly after obtaining a DB connection with Spring Boot? The SQL needs to be run each time a new connection is established. The solution should work with the Spring Boot default DataSource implementation (which I think is a Tomcat pooling data source). It doesn't really matter what the statement is, but in my case it will be ALTER SESSION SET CURRENT_SCHEMA=xxxx Ralph Tomcat Jdbc Connection pool has a parameter "initSQL" https://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html It looks like you can configure each pool parameter in your .properties file (

Grails multi datasource domain issue

南笙酒味 提交于 2019-12-01 00:18:48
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 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property

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

China☆狼群 提交于 2019-11-30 23:41:39
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://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">

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

ⅰ亾dé卋堺 提交于 2019-11-30 21:52:04
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). I'm getting frustrated by all the wizards and dialog boxes and I still can't find what I'm looking for

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

删除回忆录丶 提交于 2019-11-30 21:40:40
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 gridview")] public int EquipID {get;set;} if not I'll just stick with the old tired ways Later on that