[Spring] Using Spring's Abstract Routing Data Source to switch multiple data sources
Recently, because the project needs to do data synchronization between two projects, specifically project 1's data is synchronized to project 2 through message queue, because this update operation also involves updating the data of multiple databases, so it needs the operation of switching multiple data sources. Here's how to switch data source ...
Posted by breath18 on Sun, 31 Mar 2019 19:18:30 -0700
Simple Use of JDBC and c3p0
dbcp is an open source connection pool for apache.
C3P0 is an open source JDBC connection pool, which implements data source and JNDI binding, supports JDBC3 specification and JDBC2 standard extension. At present, open source projects using it include Hibernate, Spring, etc.
Simple use of dbcp
First, you must import the relevant jar package ...
Posted by grayscale2005. on Sun, 31 Mar 2019 17:51:28 -0700
The Simplest Understanding of StringBoot Configuration Multi-Data Source Tutorial
Bullshit does not say much directly on the code "novice on the road God do not spray!"
1 First, you need to build a Springboot project. I won't show you how to build it.
2. Configure two data sources in the configuration file
3. Setting up two config classes
import org.apache.ibatis.session.SqlSessionFactory ...
Posted by rocram16 on Sat, 30 Mar 2019 08:57:29 -0700
Hand-in-hand to do a JSP introductory program (3): DBHelper class design -- connect to mysql database
DBHelper class design - Connect to mysql database
_DBHelper (DataBase Helper) is mainly used to help us operate the database, in which we will create a method to obtain database connections. We'll put it in the util ity package, which acts as a toolkit.
In order to access MySQL database, we need a jar package to connect mysql: mysql-connecto ...
Posted by Sprout on Fri, 29 Mar 2019 13:48:27 -0700
Summary of Spring Learning
IOC of spring
I. Introduction to spring
The Spring framework is a layered architecture consisting of seven well-defined modules. The Spring module is built on top of the core container, which defines how bean s are created, configured, and managed.
Each module (or component) that makes up the Spring framework can exist independently or b ...
Posted by shadowwebs on Wed, 27 Mar 2019 05:51:28 -0700
Java Development-DAO Design Patterns and Optimizations
What is DAO?
DAO is Data Access Object Data Access Interface, as its name implies: dealing with the database. Sandwiched between business logic and data resources.
What are the DAO models?
The DAO pattern is actually a combination of two patterns: the Data Accessor pattern and the Active Domain Object pattern.
Their significance an ...
Posted by sawade on Fri, 22 Mar 2019 06:54:53 -0700
Druid connection pool setting triggers a blood case [abandon connection, open stackTrace]
Running batch updates on a very low-configuration machine today~~~
Running for about 30 minutes ~~This configuration ~~This program~~~
And then the magnificent newspaper went off the beaten track.~~~
This is the specific exception.
DEBUG: (BaseJdbcLogger.java:132) ooo Using Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@4d4 ...
Posted by Wo0tHigh on Tue, 19 Mar 2019 19:09:27 -0700
Solution to the problem of java.sql.SQLException: No suitable driver
Recent problems encountered in writing a small program: I use the c3p0 connection pool for database connection, the project of eclipse imported in MyEclipse 2014 environment, and configure it in the c3p0 configuration file (c3p0-config.xml) as follows:
<?xml version="1.0" encoding="UTF-8"?>
<c3p0-config>
<default-config> ...
Posted by jumphopper on Tue, 12 Feb 2019 07:42:17 -0800
Use of mybatis - mybatis prints sql logs with log4j
1.Maven refers to the jar package
The default mybatis can't print out the SQL log, which is not easy to view and debug. It needs to be combined with log4jdbc-log4j2 to complete the input of the debugging information of SQL.
Configure maven with pom.xml. Note that all three of the following are required
<dependency>
< ...
Posted by dmb on Mon, 11 Feb 2019 11:45:19 -0800
Java JDBC Connection SQL Server 2005 Error: TCP/IP Connection Failed to Connect to Host localhost via Port 1433
The reasons for the error are as follows:
Exception in thread "main" org.hibernate.exception.JDBCConnectionException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:99)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.exception.JDBCExc ...
Posted by strangebeer on Sun, 10 Feb 2019 18:54:18 -0800