简体   繁体   English

学习JDBC应该涵盖的主题

[英]The topics that should be covered for learning JDBC

I have been asked to learn JDBC. 我被要求学习JDBC。 I do not know where to start. 我不知道从哪里开始。 I have started with some books. 我从一些书开始。 It's using some SQL tables (I am also new to SQL). 它正在使用一些SQL表(我也是SQL的新手)。 So I want any of you to assist me that the topics that should be covered for JDBC. 因此,我希望任何人能帮助我解决JDBC应该涵盖的主题。 I also want to know how to creae a simple DB in Windows, so that database will be connected to my program. 我还想知道如何在Windows中创建一个简单的数据库,以便将数据库连接到我的程序。

Which books, materials are useful to know for: 哪些书籍,材料对于以下方面有用:

  • Java Beginners Java初学者
  • JDBC JDBC
  • Connection between Java & JDBC (I do not know whether its right or not) Java和JDBC之间的连接(我不知道它是否正确)
  • Relation between Java & SQL. Java与SQL之间的关系。

Start by focusing on accessing a Database using SQL. 首先着重于使用SQL访问数据库。

JDBC just lets your write Java code to call the SQL, so you need to understand SQL first, and to understand SQL you need to understand Databases a little: Tables, Columns, Keys. JDBC只允许您编写Java代码来调用SQL,因此您需要首先了解SQL,并且要了解SQL,您需要稍微了解数据库:表,列,键。

So you could work through a tutorial such as this link text . 这样您就可以完成本教程,例如此链接文本

Java Beginners Java初学者

Head to Sun Oracle's own tutorials. 前往 Sun Oracle自己的教程。


JDBC JDBC

Again, the vendor's own tutorials are the best (only learn it after basic Java!): 同样,供应商自己的教程是最好的(仅基本Java 之后学习!):

You'd like to learn SQL first beforehand (learn it before JDBC): 您想先学习SQL( JDBC 之前学习):


Connection between Java & JDBC (I do not know whether its right or not) Java和JDBC之间的连接(我不知道它是否正确)

JDBC is a Java API (a set of interfaces and classes). JDBC是Java API(一组接口和类)。 There is no such thing as "connect between Java and JDBC". 没有“ Java和JDBC之间的连接”之类的东西。 You rather want to connect between Java and the database. 您宁愿在Java和数据库之间进行连接。 You use JDBC for this. 为此,您使用 JDBC。 You first need to know the JDBC URL of the database in question and the login username and password. 您首先需要知道所讨论数据库的JDBC URL以及登录用户名和密码。 Then you can connect it like follows: 然后,您可以按如下所示进行连接:

Connection connection = DriverManager.getConnection(url, username, password);

How the URL should look like depends on the DB and JDBC driver in question. URL的外观取决于所讨论的DB和JDBC驱动程序。 You'd like to consult the documentation of the JDBC driver in question. 您想查阅有关JDBC驱动程序的文档。


Relation between Java & SQL. Java与SQL之间的关系。

Nothing. 没有。 Both are separate and independent languages each with an own purpose. 两者都是独立的独立语言,每种都有自己的目的。 SQL is a database communication language. SQL是一种数据库通信语言。 Java is an object oriented programming language. Java是一种面向对象的编程语言。 In Java, you can use the JDBC API to execute SQL programmatically, but that's also really all. 在Java中,您可以使用JDBC API来以编程方式执行 SQL,但实际上仅此而已。


I also want to know how to creae a simple DB in Windows, so that database will be connected to my program 我也想知道如何在Windows中创建一个简单的数据库,以便将数据库连接到我的程序

Just choose a database server and download and install it. 只需选择一个数据库服务器并下载并安装它即可。 There are several popular choices: 有几种流行的选择:

Each of them also ships with DB vendor specific JDBC documentation. 它们每个还附带有数据库供应商特定的JDBC文档。 It's also worth to get yourself through it (only if you already understand basic JDBC!). 值得一读(仅在您已经了解基本JDBC的情况下!)。


See also: 也可以看看:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM