简要说明:JDBC如何工作? [英] A brief explanation : how JDBC works?

查看:110
本文介绍了简要说明:JDBC如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以用简单的词语解释实现JDBC的步骤究竟是什么意思?
每一步的重要性是什么?为什么需要DriverManager类?
这是什么?什么是司机首先?它有什么作用?基本上我想要JDBC的内部工作(关于MySqL),它是如何实现的?
在使用MySql连接java时,端口的重要性是什么?为什么需要用户名和密码?

can anyone in simple words explain what exactly the "steps" in implementing a JDBC mean? What is the importance of each step? Why DriverManager class is required? what is it? What is a Driver in first place? what does it do? Basically I want the internal working of JDBC (with respect to MySqL) , and how is it carried out? And also while connecting java with MySql, what is the importance of port? and why is username and password required?

推荐答案


为什么需要DriverManager类?是什么?

Why DriverManager class is required? what is it?

DriverManager 是注册表和查找机制。它负责获取数据库连接 URL 并找到一个能够使用它的合适驱动程序。

The DriverManager is registry and lookup mechanism. It is responsible for taking the database connection URL and finding a suitable driver capable of using it.

DriverManager 用于维护每个驱动程序的单个实例,这减少了所需的资源数量,并且无需在内存中运行相同驱动程序的多个实例...

The DriverManager is used to maintain a single instance of each driver, which reduces the number of resources required and prevents the need for having multiple instances of the same driver running in memory...

例如,MySQL的常规 URL jdbc:mysql:// DriverManager 询问每个驱动程序是否理解 URL ,当它找到一个时,它会将URL传递给它以创建实际连接。

For example, the general URL for MySQL starts with jdbc:mysql://. The DriverManager asks each driver if it understands the URL, when it finds one, it passes the URL to it to create the actual connection.


首先是什么驱动程序?它是做什么用的?

What is a Driver in first place? what does it do?

驱动程序是应用程序和数据库之间的契约。它是一种可以编写可以用于多个数据库的标准化代码的方法,实际上并不需要知道或关心这些调用是如何物理地对数据库进行的。

The driver is a contract between your application and the database. It is a means by which it's possible to write standardized code that can be used against multiple databases, which doesn't actually need to know or care how those calls are physically made to the database.


在使用MySql连接java时,
端口的重要性是什么?

And also while connecting java with MySql, what is the importance of port?

这是计算机之间通信的一个非常基本的概念。将计算机视为一个单元块。为了向这台计算机发送一封信,你需要一个地址,这就是计算机的IP地址。您还需要知道发送信件的单位,这是端口号。

This is a very basic concept of communication between computers. Think of a computer as a block of units. In order to send a letter to this computer, you need an address, this would be the computers IP address. You also need to know the unit you are sending the letter to, this is the port number.

这使您不仅可以与计算机通信,还可以与单个进程通信。如果你只能与一个流程交谈,生活会非常困难。

This allows you to talk with not only the computer, but an individual process. Life would be pretty difficult if you could only talk to one process.


为什么需要用户名和密码?

and why is username and password required?

这降低了安全性。它不仅描述了谁可以连接到特定数据库,还描述了他们可以做什么,例如插入,更新,删除和创建数据库对象。

This comes down security. It describes not only who can connect to a particular database, but what they can do, like insert, update, delete and create database objects.

这篇关于简要说明:JDBC如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆