JDBC连接 [英] JDBC connection

查看:106
本文介绍了JDBC连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计们 我是Java编程的新手,谁能给我一些有关JDBC连接的好书. 我必须将Java程序连接到数据库. 另外,在网上搜索时,我发现以下语句有点令人困惑

Hi folks I am new to java programming.Can anyone suggest me some good reading for JDBC connection. I have to connect my java program to a database. Also while searching on net i found the following statement a bit confusing

1)Connection dbConnection=DriverManager.getConnection(url,"loginName","Password")

2)Statement statement = dbConnection.createStatement();

在第二条语句中,"createStatement"是接口连接"的方法.

In the second statement "createStatement" is a method of "Interface Connection".

如何调用接口的方法?

推荐答案

Ajay, JDBC是Sun(现在是Oracle :-()..

Ajay, JDBC is an API (Standard) published by Sun (now Oracle :-( )..

编写代码时,您可以使用API​​编写基于接口的代码(注意:打开javadoc并查看... JDBC是接口的集合.java.sql.*包)

When you code, you use the API to write the code based in interfaces (NOTE: Open javadoc and see... JDBC is a collection of interfaces.. java.sql.* package)

要运行该应用程序时,必须使用数据库供应商提供的实现... 所有提供JDBC支持的数据库供应商都必须提供此实现. classes12.jar或ojdbc14.jar等...在zip实用程序中打开该jar文件,您可以看到类java.sql.Interface等...

When you want to run the application, you have to use an implementation provided by the Database vendor... All DB vendors that provide JDBC support have to provide this implementation. classes12.jar or ojdbc14.jar etc... Open that jar file in zip utility and you can see the classes java.sql.Interface and so on...

这些是实现您在问题中问到的接口的具体类....

those are the concrete classes that implement the interfaces that you asked about in your question....

因此,您实际上正在使用一个具体的类.了解有关Java继承的信息.

SO you are actually using a concrete class. Learn about inheritance in java.

这些可能对您有帮助

http://www.oracle.com/technetwork/java/overview- 141217.html

http://download.oracle.com/javase/tutorial/jdbc/basics/index.html

http://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/JDBC20.html

http://www.roseindia.net/jdbc/jdbc.shtml [很好的教程]

希望这对您有帮助...

hope this helps...

谢谢.

这篇关于JDBC连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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