- Spring JDBC is a powerful mechanism to connect to The database and execute SQL queries.
- We use JDBC template class to connect to database and perform operations.
- JDBC is an API to perform operations with database.
- Problems with old JDBC.
- We need to write a lot of code as we need to repeatedly open JDBC connection, get and execute statement and close the connection.
- Exception handling problem in which we need to handle checked exception i.e. SQL exception.
- Repeating all these codes from one to another database, logic is a time consuming task.
- Spring JDBC corrects all the above problems.
- JDBC template requires following dependencies
- DataSource
- A source which contains all metadata of our database.
- DriverManagerDataSource class is passed as implementation of DataSource Interface.
- Information required by DriverManagerDataSource to Interact with database is as follows.
- DriverClassName
- URL of database
- Username
- Password
- JDBC template has following important methods
- Update for insert, update, delete queries.
- Execute for select queries.
- Swing JDBC select data using following methods.
- For single object
- Selecting data using Spring JDBC.
- Public T queryForObject(String sql, Rowmapper <T> rowmapper,Object args…)
- For multiple object
- Public List<T> query (String sql,RowMapper <T> rowmapper)
- Row Mapper converts result set object into object of class.
- Annotations
- Controllers
- Components
- Dependencies
- Documenting Java Code
- Entities
- Hibernate
- HTTPS Security
- Spring Core
- Maven
- Spring MVC
- Microservices
- Packages
- Project Configuration
- REST Templates
- Spring Boot
- AOP
- Spring DI
- Spring IOC
- Spring Data
- Tag Library
- View Resolvers
- Validations,Errors & Exceptions
- Activiti Framework
- Deploy spring boot Microservices in Fargate
- Spring Security
- Password encryption using Jasypt
- Flyway DB Migration Script
- Session in Spring Boot
- Spring Expression Language
- Spring JDBC
- Spring ORM
- Testing Spring Boot
- Correlation ID
- Logging
- ELK Stack
- EFK Stack
- Swagger
- Rabbit MQ
- Circuit Breaker Pattern
- Connection Pooling
- Spring Batch
- Zipkins
- Kafka
- Spring Boot Actuator
- Spring Cloud
- Caching
- Gateway
- Service Discovery
Spring JDBC
Subscribe to:
Posts (Atom)
Spring Boot
What is circular/cyclic dependency in spring boot? When two services are interdependent on each other, that is to start one service, we requ...
-
What is JPA? JPA Is also called as Java persistence API It is a standard form oracle to map object to database relations. Provides specific...
-
Technology's / frameworks in Spring Spring core Spring MVC Spring boot Spring data Hibernate
-
Q What is the minimal web version required to use JSTL? And : 2.4 For example following tag from web.xml uses web 4.0 <web-app xmlns:xs...
No comments:
Post a Comment