***

Blob (binary large object), a binary large object, is a container that can store binary files. In the computer, blob is often the field type used to store binary files in the database. Blob is a large file. A typical blob is a picture or a sound file. Due to their size, they must be processed in a special way (for example, upload, download or store in a database).

1、 Basic concepts

In actual development, sometimes it is necessary to save large text or binary data directly to the database for storage.

For MySQL, there is only blob, not CLOB. MySQL stores large text in text. Text and blob are divided into:

Tinytext, text, mediumtext and longtext

Tinyblob, blob, mediablob and longblob

2、 Build test environment

2.1 test project architecture

As shown in the figure:

2.2. Write dB Properties configuration file

2.3. Write jdbcutils tool class

3、 Use JDBC to process large text of MySQL

For the text type in mysql, you can call the following method to set

For the text type in mysql, you can call the following method to obtain

3.1 test examples

1. Write SQL test script

2. Write the test code as follows:

4、 Using JDBC to process binary data of MySQL

For blob types in mysql, you can call the following methods to set:

For the blob type in mysql, you can call the following method to obtain:

4.1 test examples

1. Write SQL test script

2. Write the test code as follows:

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>