Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does IDEA use JDBC installation and configuration jar package to connect to MySQL database

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the relevant knowledge of "how IDEA uses JDBC installation and configuration jar package to connect to MySQL database". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1. Query MySQL version 1) Log in to mysql

First of all, Window+R

Then enter it on the command line

Mysql-u fill in your mysql account here (please add-u)-p (here is the password) take mine as an example, mysql-uroot-prota

Shows that the login is successful after this.

2) query version number select version ()

Mysql > select version ()

+-+

| | version () |

+-+

| | 5.5.56 |

+-+

1 row in set (0.00 sec)

Download the corresponding Jar package 8.0.12 high version

Link: https://pan.baidu.com/s/1_rLG6YybrD-wfSHFoDbiFw

Extraction code: clim

5.56 adapts to lower version

Link: https://pan.baidu.com/s/15ginp4GYHibLdblxBRcTOw

Extraction code: bxbu

III. Configuration

First of all, you need to right-click in the folder to copy the jar package we have downloaded. After creating a new project, double-click .idea to open it and select paste ~

Just confirm it directly after pasting.

If you copy and paste a jar package without the following step, your jar package will be as useless as if it were not configured! So here's the point. Ow.

It will show that the symbol getConnection cannot be solved, that is, the compiler lacks Jar to recognize your corresponding API.

So we also need to right-click the Jar package as a library dependency

English IDEA should be add as libraries~~~

It's done, and it can run normally.

Fourth, the supplementary part is written at the end.

In our daily process of moving bricks, as long as you are involved in Java projects, you will inevitably come into contact with jar packages. In the actual development, project management tools such as maven automatically manage the jar package and related dependencies for us, making the call of the jar package look like a black box. Today, let's take this rare opportunity to unlock this black box and explore the mysteries.

Here to repeat the concept, jar package is Java Archive File, as the name implies, its application is closely related to Java, is a document format of Java, is a platform-independent file format, multiple files can be synthesized into one file. The jar package is very similar to the zip package-to be exact, it is the zip package, so it is called the portfolio. The only difference between jar and zip is that the content of the jar file contains a META-INF/MANIFEST.MF file, which is created automatically when the jar file is generated. As a "detail sheet" in jar, it contains information such as the version of the Jar package, creator and class search path Class-Path. Of course, if it is an executable Jar package, it contains the Main-Class attribute, indicating the entry of the Main method. Especially the more important Class-Path and Main-Class.

What is JDBC?

JDBC refers to Java database connection (Java Database Connectivity), is a standard Java application programming interface (JAVA API), JDBC is a set of interfaces defined by sun company, JDBC is essentially a set of interfaces (interface) developed by Sun company! Each database vendor needs to implement this set of interfaces. We only need to call the need to connect to the Java programming language and a wide range of databases.

The JDBC API library contains each of the tasks mentioned below, which are common database-related uses.

Make a connection to the database.

Create a SQL or MySQL statement.

Execute SQL or MySQL to query the database.

View and modify the resulting records.

Basically, JDBC is a specification that provides a complete set of interfaces that allow portable access to the underlying database, so different types of executables can be written in Java, such as:

Java application

Java Applets

Java Servlets

Java ServerPages (JSPs)

Enterprise JavaBeans (EJBs)

All of these different executable files can use the JDBC driver to access the database, so that you can easily access the data.

JDBC has the same performance as ODBC, allowing Java programs to contain code that is independent of the database.

This article is my previous original article.

The Jar package of MySQL that we need to configure is the interface provided by JDBC and a series of implementation classes implemented by MySQL Java programmers.

JDBC is essentially a set of interface developed by Sun! Each database vendor needs to implement this set of interfaces. We only need to call the need to connect to the Java programming language and a wide range of databases.

This is the end of the introduction to "how IDEA uses the JDBC installation and configuration jar package to connect to the MySQL database". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report