![swissknife 3.09 swissknife 3.09](https://www.team-bhp.com/forum/attachments/post-war/1688774d1508760224-landmaster-ambassador-picture-gallery-forumrunner_20171023_173345.png)
In addition, with the default implementation of MySQL Connector/J, only client-side statements are preprocessed, and the statements are sent to the server in a text file after ? is replaced on the client. If you use the JDBC API directly for development, pay attention to choosing the Prepare API. This avoids the overhead of repeatedly parsing and generating SQL execution plans in TiDB.Īt present, most upper-level frameworks call the Prepare API for SQL execution. Therefore, it is recommended to use Prepared Statements instead of regular execution from a text file and reuse Prepared Statements to execute directly. Use Prepare APIįor OLTP (Online Transactional Processing) scenarios, the SQL statements sent by the program to the database are several types that can be exhausted after removing parameter changes. This section covers the usage of several important APIs. API Implementer's parameter configurationįor JDBC API usage, see JDBC official tutorial.For JDBC, it is recommended that you focus on the following things:
![swissknife 3.09 swissknife 3.09](https://ars.els-cdn.com/content/image/1-s2.0-S0191814105000040-gr3.jpg)
In most of the frameworks, JDBC API is called on the bottommost level to interact with the database server. Java applications can be encapsulated with various frameworks. The rest of this document describes the issues and their solutions when you develop a Java application using the above components.
![swissknife 3.09 swissknife 3.09](https://s.alicdn.com/@sc01/kf/HTB1YEqDSpXXXXX8aFXXq6xXFXXX7.jpg)
Use a data access framework such as MyBatis to generate and execute SQL statements.Get a persistent connection from the connection pool.Implement the MySQL protocol via the JDBC API to interact with TiDB.Some applications use Spring Transaction aspects to manage transactions' start and commit logics.įrom the above diagram, you can see that a Java application might do the following things: Application implementation: The application logic controls when to send what commands to the database.Data access framework: Applications usually use a data access framework such as MyBatis and Hibernate to further simplify and manage the database access operations.You can choose from different open-source connection pool implementations as needed. JDBC DataSource defines a connection pool API. Database connection pool: To reduce the overhead of creating a connection each time it is requested, applications usually use a connection pool to cache and reuse connections.
#Swissknife 3.09 drivers#
Such common JDBC drivers for MySQL include MySQL Connector/J and MariaDB Connector/J.
#Swissknife 3.09 driver#
To connect to TiDB, you can use a JDBC driver that implements the MySQL protocol via the JDBC API. JDBC API and JDBC drivers: Java applications usually use the standard JDBC (Java Database Connectivity) API to access a database.Network protocol: A client interacts with a TiDB server via the standard MySQL protocol.Database-related components in Java applicationsĬommon components that interact with the TiDB database in Java applications include: Based on some common Java application components that interact with the backend TiDB database, this document also provides the solutions to commonly encountered issues during development. This document introduces the best practice for developing Java applications to better use TiDB. Best Practices for Developing Java Applications with TiDB