Skip to content

Tag: datasource

How does JDBC DataSource works?

I wondered how works method getConnection() at DataSource? I assume that DataSource calling DriverManager.getConnection every time when we call DataSource.getConnection with our properties that we setting in DataSource. Is that true? Answer The answers to your question can be deduced from the DataSource javadoc. “The DataSource interface is implemented by a driver vendor. There are three types of implementations: Basic

Error creating bean with name ‘batchDataSource’: Requested bean is currently in creation: Is there an unresolvable circular reference?

I have a batch configuration. I saw the batch process is default using InMemoryMap. Instead I need to use the MySQL to send all the execution details by Batch. But when I use the following code I am getting the following error, Error creating bean with name ‘batchDataSource’: Requested bean is currently in creation: Is there an unresolvable circular reference?

Spring Boot 2 datasource by configuration does not work

I have an application.yml(!) for the configuration containing the following: Which gives me the errormessage: Doing it this way works: Ideas? 🙂 Answer Rename driverClassName to driver-class-name since Kebab case is preferred over Camel case in Spring Boot Auto Configuration properties. If that doesn’t help then make sure that you didn’t turn off DataSourceAutoConfiguration feature. It usually may look like

Configure a `DataSource` to connect to a managed Postgres server on Digital Ocean with SSL/TLS encryption

I am trying the managed database service on, having created a Postgres instance. Digital Ocean defaults to requiring remote connections be made with SSL (actually TLS) encryption. How does one configure a JDBC DataSource implementation for providing connections to such a database server? This Question is similar to Produce a DataSource object for Postgres JDBC, programmatically but adds the

Java memory leak with a data source

I have heard many times that not closing database connections might lead to a memory leak. (For example in this article) I tried reproducing the same issue by getting a connection from org.apache.commons.dbcp2.BasicDataSource and not closing it. This is my code: I have repeated the same process almost 400 times and also decreased the initial and max heap sizes. Still,

Error when looking up data source name when deploying httpServlet to weblogic 12 server

I am trying to deploy an ear file to a Weblogic 12 server. The ear file contains a HttpServlet. During deployment, the HttpServlet is trying to initialize and fails with this error: Target state: deploy failed on Cluster javax.naming.NameNotFoundException: While trying to lookup ‘jdbc.’ didn’t find subcontext ‘jdbc’. Resolved ” at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException( I tested the data source connection on the

How do I manually configure a DataSource in Java?

I’m trying to follow Sun’s JDBC tutorial at It gives the following example code: This code doesn’t compile because the DataSource interface has none of these methods, except for the getConnection() method invoked last. (Here’s the javadoc: What am I missing? Edit: I’m actually trying to connect to MySQL (com.mysql.jdbc) and I can’t find the javadoc for that.