datasource

How to configure a global JNDI datasource in Tomcat 6?

白昼怎懂夜的黑 提交于 2019-12-03 16:17:28
I'm struggling to configure a simple JNDI pooled datasource in Tomcat 6.0.32. I want to create the datasource definition outside my web application artifact. Basically I don't want my application to know the credentials to access the database server. I was under the assumption that, like in Weblogic, it should be possible to create a "global" JNDI datasource in Tomcat, but so far I have been unsuccessful. I have tried to add the datasource definition in CATALINA_HOME/conf/context: <Resource name="jdbc/mydb" auth="Container" type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"

New method added in javax.sql.CommonDataSource in 1.7

旧时模样 提交于 2019-12-03 15:59:58
问题 Trying to compile my app against java 1.7 I found what there was a new method added in javax.sql.CommonDataSource (and so in j.s.DataSource) -- . getParentLogger() . You can compare CommonDataSource:1.7 with CommonDataSource:1.6 For me this change definitely breaks backward compatibility. For example, my app (which contains implementations of DataSource) even doesn't compile against 1.7 without changes in code. By my opinion, it should be very strong reasons for doing this -- but I can't

How to separate the selected item of two combobox with a single DataSource?

▼魔方 西西 提交于 2019-12-03 15:30:53
On a form, I have two combobox wich have the same DataSource (their elements list are the same). When the user select an item in one of the control, the other control's selected item is also modified. That's not what I want. I'd like to have both list populated with the same DataSource (as I currently do), but I'd like their selected items to be independent from each other. How can I do that? Or you could use... var dataSource = new[] { "item1", "item2", "item3" }; comboBox1.DataSource = dataSource; comboBox2.BindingContext = new BindingContext(); comboBox2.DataSource = dataSource; You need to

How can one disable the first autoselect in a VS datagridview?

半腔热情 提交于 2019-12-03 14:14:18
I have created an application in Visual Studio (C#) that makes use of a datagridview. Now, when I assign the DataSource of that datagridview, it automatically selects the first row, and executes my code for selection. Since I frequently reassign that datasource, this is not desireable. Is there any way to change it so it doesn't automatically make that first select, and only relies on the user's selections? Thanks! In response to the comment of Darshan Joshi: Apart from the auto-generated code, the only thing altered on the datagridview is setting AutoGenerateColumns to false, and setting the

Grails: Getting the Data Source in a normal groovy class

孤街醉人 提交于 2019-12-03 13:53:06
How can I get access to the data source from within a normal groovy class? Injection doesn't work like it does with services. The reason for this is that I need to do some manual database calls (ie: SQL statements using the groovy.sql.Sql class) from the groovy class since I'm working with a legacy database. dataSource is a bean which gets auto injected in services when used. All beans are auto wired in grails artifacts (controllers, services etc) by default. In your case you are using a POGO and I suppose it would be inside src/groovy . You can inject the dataSource bean explicitly to POGO

Cached connection manager in jboss/wildfly

允我心安 提交于 2019-12-03 12:07:07
I have defined a datasource for JBoss AS 7.4, with min/max pool sizes, tracing of idle connections etc. I am confused about the datasource use-ccm property. What does it do? Why use it? I thought the datasource itself manages the connection pool. BalusC What does it do? It's just a useful debugging tool to detect connection leaks in manually managed transactions (BMT) by inspecting its logging. When turned on in debug mode, it will log all connections acquired and released by application code, along with the queries. This can be used to trackback connection leaks in application code. The JBoss

Spring DriverManagerDataSource vs apache BasicDataSource

对着背影说爱祢 提交于 2019-12-03 11:08:50
问题 What is the difference between Spring DriverManagerDataSource and apache BasicDataSource? Which of them is preferable and in which situations? Thank you. 回答1: As per the Spring documentation This class is not an actual connection pool; it does not actually pool Connections. It just serves as simple replacement for a full-blown connection pool, implementing the same standard interface, but creating new Connections on every call. If you need a "real" connection pool outside of a J2EE container,

Add a Row After Setting DataSource to Datagridview

亡梦爱人 提交于 2019-12-03 10:26:46
I had lots of questions related to datasource binding of datagrid. I had a DatagridView to which I am setting DataSource from a list List<Myclass> li = new List<MyClass>(); MyClass O = new MyClass(); O.Name = "Aden"; O.LastName = "B"; O.Id = 12; li.Add(O); O = new MyClass(); O.Name = "Li"; O.LastName = "S"; O.Id = 22; li.Add(O); Mydgv.DataSource = li; Where MyClass is public Class MyClass { public string Name {get; set;} public string LastName {get; set;} public decimal Id {get; set;} } Now Want to add a new Row to My DataGridView DataGridViewRow row = (DataGridViewRow)yourDataGridView.Rows[0]

How can I spoof a jndi lookup for a datasource without a app server

二次信任 提交于 2019-12-03 09:53:26
问题 I want to test some new functionality which is part of an internal web app. This new code uses a database connection normally provided by an app server (tomcat). I do not want to recreate the entire web app on my local machine to test the new code, since I only need to run one function. Does anyone know how I can 'spoof' a Context, or Datasource, to retrieve the database config, without actually creating a web app instance on a server? 回答1: With the help of Spring SimpleNamingContextBuilder

JBoss Database Connection Pool

本秂侑毒 提交于 2019-12-03 09:53:25
问题 I am new to jboss and i have been asked to incorporate jboss connection pooling mechanism with an existing web application. Considering that a web application database layer is properly written i.e. all resultsets, statements and connections being closed properly when not needed, What all code changes i will have to make in my web app after i have configured the jboss datasource properly. Can anybody please point me to a tutorial or a code sample which uses jboss datasource in a web app. 回答1: