Multiple data source and schema creation in Spring Boot

spring.jpa.hibernate.ddl-auto=create has stopped working, not because you have two DataSources, but because your application’s creating its own LocalContainerEntityManagerFactoryBeans. This has the effect of disabling the auto-configuration of a LocalContainerEntityManagerFactoryBean so you now have to configure it yourself. You can configure the two entity managers to have different schema generation behaviour like this (the first’s doing … Read more

jboss 7 oracle datasource configuration

Here’s a link about the data source configuration for JBoss 7 that of course work with 7.1 https://community.jboss.org/wiki/DataSourceConfigurationInAS7 The example is configuring a MySQL example. This is what i did for an Oracle Driver <datasource jndi-name=”java:/sigap_ws_receiver” pool-name=”sigap_ws_receiver” enabled=”true”> <connection-url>jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=off)(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.1)(PORT=1524))(CONNECT_DATA=(SERVICE_NAME=profepa)(SERVER=DEDICATED)))</connection-url> <driver>com.oracle</driver> <pool> <min-pool-size>3</min-pool-size> <max-pool-size>5</max-pool-size> </pool> <security> <user-name>user</user-name> <password>pass</password> </security> <validation> <exception-sorter class-name=”org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter”/> </validation> <timeout> <blocking-timeout-millis>5000</blocking-timeout-millis> <idle-timeout-minutes>5</idle-timeout-minutes> … Read more

Binding Combobox Using Dictionary as the Datasource

SortedDictionary<string, int> userCache = new SortedDictionary<string, int> { {“a”, 1}, {“b”, 2}, {“c”, 3} }; comboBox1.DataSource = new BindingSource(userCache, null); comboBox1.DisplayMember = “Key”; comboBox1.ValueMember = “Value”; But why are you setting the ValueMember to “Value”, shouldn’t it be bound to “Key” (and DisplayMember to “Value” as well)?

How to test a mocked JNDI datasource with Spring?

You can use SimpleNamingContextBuilder to make a jndi datasource available to your tests: SimpleNamingContextBuilder builder = new SimpleNamingContextBuilder(); builder.bind(“java:comp/env/jdbc/mydatasource”, dataSource); builder.activate(); https://fisheye.springsource.org/browse/spring-framework/spring-test/src/main/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java?hb=true This isn’t exactly mocking the datasource, but it does make the datasource available via jndi for your tests.

Configure DataSource programmatically in Spring Boot

You can use DataSourceBuilder if you are using jdbc starter. Also, in order to override the default autoconfiguration bean you need to mark your bean as a @Primary In my case I have properties starting with datasource.postgres prefix. E.g @ConfigurationProperties(prefix = “datasource.postgres”) @Bean @Primary public DataSource dataSource() { return DataSourceBuilder .create() .build(); } If it … Read more

ERROR : [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

If you’re working with an x64 server, keep in mind that there are different ODBC settings for x86 and x64 applications. The “Data Sources (ODBC)” tool in the Administrative Tools list takes you to the x64 version. To view/edit the x86 ODBC settings, you’ll need to run that version of the tool manually: %windir%\SysWOW64\odbcad32.exe (%windir% … Read more

implement dynamically datasource in spring data jpa

You can try AbstractRoutingDatasource provided by Spring since version 2.0.1. using which you can dynamically use appropriate data-source . For integration with Spring data JPA check this very good example. In your case since your configurations are in DB instead of properties file you would need to perform an extra first database lookup to get … Read more

Using a list as a data source for DataGridView

First, I don’t understand why you are adding all the keys and values count times, Index is never used. I tried this example : var source = new BindingSource(); List<MyStruct> list = new List<MyStruct> { new MyStruct(“fff”, “b”), new MyStruct(“c”,”d”) }; source.DataSource = list; grid.DataSource = source; and that work pretty well, I get two … Read more

How to pass main report data source to subreport (JasperReports)?

You can pass datasource via the built-in REPORT_DATA_SOURCE parameter. The example: <subreport> <reportElement x=”261″ y=”25″ width=”200″ height=”100″/> <dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></dataSourceExpression> <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + “subreport.jasper”]]></subreportExpression> </subreport> You can create new instance of datasource based on variable, parameter or field. The sample: <variable name=”HeadingsCollection” class=”java.util.Collection” calculation=”System”> <initialValueExpression><![CDATA[new java.util.ArrayList()]]></initialValueExpression> </variable> … <subreport> <reportElement x=”0″ y=”0″ width=”515″ height=”20″/> <subreportParameter name=”ReportTitle”> <subreportParameterExpression><![CDATA[$P{ReportTitle}]]></subreportParameterExpression> </subreportParameter> … Read more