SQL 数据库和 Java
我有一个任务是制作一个将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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
每个 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.
您需要找到合适的 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.
你有没有看这里
你需要一个与你的jdk版本兼容的版本。
did you look here
you need one that compatible with your version of jdk.
当您谈论版本时,您是在谈论不同的数据库驱动程序提供程序还是 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.
每个数据库制造商都实现了一个驱动程序来连接到他们的数据库系统。 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:
I hope this helps.
你所说的差异可能是由两件事引起的,一是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.