0

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

2
  • Which database are you using? Commented Apr 28, 2011 at 11:33
  • Which version of Java are you using? Which database do you want to connect to? Commented Apr 28, 2011 at 11:33

6 Answers 6

1

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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.

1 Comment

You sure have telepathy...how do you know that he's referrring to a Microsoft SQL Server?
0

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?

Comments

0

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.

Comments

0

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.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.