JDBC实现如何工作

编程入门 行业动态 更新时间:2024-10-10 10:32:05
本文介绍了JDBC实现如何工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在JDBC中,我看到 Connection 是一个接口,它定义了与数据库交互的方法。

In JDBC, I see that Connection is an interface, which defines methods for interacting with Database.

我也知道接口只包含抽象方法,并且无法实例化

I also know that interface contains only abstract methods, and cannot be instantiated

但是在JDBC代码中,以下是如何工作的,

But In JDBC code, how does the following work,

Connection connection = DriverManager.getConnection("URL String"); Statement statement=connection.createStatement();

据我所知 createStatement()应该是一个抽象的方法,我...,没有任何身体

As per my doubt createStatement() should be a abstract method, i..e, without any body

但是每件事情都很好......用这个

But every thing works fine... with this

任何人都可以解释一下吗?

Can anyone explain?

推荐答案

DriverManager.getConnection 返回一个实现连接接口的对象 - 在幕后有一个真实的对象。

DriverManager.getConnection returns an object which implements the Connection interface - behind the scenes there is a real object.

更多推荐

JDBC实现如何工作

本文发布于:2023-11-23 07:30:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1620609.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:工作   JDBC

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!