SQL 数据库和 Java

发布于 2024-11-04 07:44:50 字数 304 浏览 0 评论 0原文

我有一个任务是制作一个将Java与SQL数据库连接的应用程序,当我为Google服务时,我发现我必须下载Java的JDBC驱动程序(jar文件),这将使我能够从Java连接到SQL Server数据库,但我发现了很多不同的版本。

那么,有人可以告诉我它们之间的区别吗?

我正在使用最新版本的 Java (jdk 1.6.0),我也在使用 SQL Server 2008

另外,我听说过 JDBI,它比 JDBC 更安全,所以该信息是否属实,如果属实如何使用 JDBI 代替普通 JDBC?

请尽快提供帮助

提前致谢

I have a task to make an application that will connect Java with SQL database, when I served Google I found that I have to download the JDBC driver of Java (jar files) that will enable me to connect to a SQL Server database from Java, but I have found a lot of different versions of it.

So, can anyone please tell me the differences between them?

I'm using the latest version of Java (jdk 1.6.0), also I'm using SQL Server 2008

Also, I heard about JDBI and that is secured more than JDBC, so is that info true or not, and if it's true how can I use JDBI instead of Normal JDBC?

Please help as soon as you can

Thanks in Advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

小草泠泠 2024-11-11 07:44:50

每个 SQL 数据库都有自己的驱动程序,并且有多个版本。某些 SQL 数据库有多个驱动程序。

您能告诉我们您的 SQL 数据库的确切版本和名称吗?如果没有这个,我认为我们无法建议特定的驱动程序/版本。

还有不同的 JDBC 标准,但是您应该使用与您的驱动程序匹配的版本。如果您使用最新的 JDK 6,它应该支持所有这些。

Each SQL Database has its own driver with may versions. Some SQL Databases have more than one driver.

Can you tell us your exact version and name of your SQL Database? Without this, I don't think we can suggest a specific driver/version.

There are also different JDBC standards, however you should use the version which matches your driver. If you use the latest JDK 6, it should support all of them.

累赘 2024-11-11 07:44:50

您需要找到合适的 JDBC 驱动程序才能使用 JDBC 连接到 Microsoft SQL Server。以下是 SQL Server 的首选驱动程序:

jTDS 是 Microsoft SQL Server(6.5、7、2000 和 2005)的开源 JDBC 3.0 驱动程序。将 jar 文件放入应用程序类路径中。 java.sql 包以及上面的驱动程序有助于连接到数据库。

Microsoft SQL Server 2000 JDBC 驱动程序是 Type 4 JDBC 驱动程序。您需要将 jar 文件放入 CLASSPATH 变量中。

You need to find an appropriate JDBC driver to be able to connect to Microsoft SQL Server using JDBC. Following are the preferred drivers for SQL Server:

jTDS is an open source JDBC 3.0 driver for Microsoft SQL Server (6.5, 7, 2000 and 2005). Place jar file into your application classpath. java.sql package along with above driver helps connecting to database.

Microsoft SQL Server 2000 Driver for JDBC is a Type 4 JDBC driver. You need to place the jar files in your CLASSPATH variable.

挽袖吟 2024-11-11 07:44:50

你有没有看这里
你需要一个与你的jdk版本兼容的版本。

Year   JDBC Version   JSR Specification   JDK Implementation

2006   JDBC 4.0       JSR 221             Java SE 6
2001   JDBC 3.0       JSR 54              JDK 1.4
1999   JDBC 2.1                           JDK 1.2?
1997   JDBC 1.2                           JDK 1.1?

did you look here
you need one that compatible with your version of jdk.

Year   JDBC Version   JSR Specification   JDK Implementation

2006   JDBC 4.0       JSR 221             Java SE 6
2001   JDBC 3.0       JSR 54              JDK 1.4
1999   JDBC 2.1                           JDK 1.2?
1997   JDBC 1.2                           JDK 1.1?
吹泡泡o 2024-11-11 07:44:50

当您谈论版本时,您是在谈论不同的数据库驱动程序提供程序还是 JDBC 驱动程序的类型或驱动程序的版本号?

就驱动程序提供商而言,这取决于您要连接到哪个数据库。通常,所有数据库引擎公司都会为其各自的数据库发布 JDBC 驱动程序(MS 用于 MS-SQL,Oracle 用于 Oracle 数据库等)。

就 JDBC 驱动程序的类型而言,“纯”Java 驱动程序(类型 4)是事实上的标准当出于显而易见的原因寻找 JDBC 驱动程序时。

就给定实现的给定驱动程序的实际版本号而言,只需使用最新的稳定版本即可。

When you talk of versions, are you talking about the different database driver providers or the types of JDBC drivers or the version number of the driver?

As far as driver providers are concerned, it depends on which database you are connecting to. Normally all database engine companies release JDBC drivers for their respective databases (MS for MS-SQL, Oracle for Oracle database etc.)

As far as type of JDBC driver is concerned, the "pure" Java driver (type 4) is a defacto standard when looking for a JDBC driver for obvious reasons.

As far as the actual version number of a given driver for a given implementation is concerned, just go with the most recent stable version.

燕归巢 2024-11-11 07:44:50

每个数据库制造商都实现了一个驱动程序来连接到他们的数据库系统。 JDBC 是一个 API,它定义客户端如何访问该数据库。每个驱动程序都有其实现,因此这取决于您:

  • 获取您要连接的数据库系统的最新驱动程序。最新的 JDBC 版本是 JDBC 4,因此请寻找兼容 JDBC 4 的驱动程序(如果您使用的是 JDK 6)。
  • 使用 Google 查找有关如何使用 JDBC API 连接到数据库系统的优质资源。

我希望这有帮助。

Each database manufacturers have implemented a driver to connect to their database system. JDBC is an API that defines how the client can access that database. Each driver have their implementations so it will depend upon you to:

  • Get the latest driver for the database system you want to connect. The latest JDBC version is JDBC 4 so look for a driver that is JDBC 4 compliant (if you're using JDK 6)
  • Use Google to find good resources on how to use the JDBC API to connect to your database system.

I hope this helps.

手心的海 2024-11-11 07:44:50

你所说的差异可能是由两件事引起的,一是Jars的版本,二是数据库的类型,每个数据库都有专用的驱动程序来支持数据交换。

市场上有不同的关系数据库产品,例如MS SQL Server、Oracle Database、MySQL。

至于版本,请为您的数据库选择最新稳定版本的驱动程序。

The difference that you are talking about can be caused be two things one are the version of the Jars and second is the type of database, each database has dedicated driver to support the data exchange.

On the market there are different relational databases products, for example MS SQL Server, Oracle Database, MySQL.

As regarding the version pick the latest stable release of drivers for your database.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文