Developing SQL Server based Java Apps using NetBeans IDE - What do we need to connect to Microsoft SQL Server from Java (or JDBC)?
(Page 2 of 6 )
In this first article of our series, I will show you step-by-step how to establish a connection from your Java programs to a Microsoft SQL Server database using JDBC.
If you’re interested in connecting your Java applets (or applications) to standard RDBMS databases like Oracle, Microsoft SQL Server, Informix, Sybase, and others, JDBC (Java Data Base Connectivity) is your ticket to paradise. The combination of Java’s JDBC and its huge class library makes a powerful database solution. JDBC makes the simple things even easier, without making the complex tasks too difficult.
JDBC is the most important component in the Java stack to deal and work with databases (even at the enterprise level). It even has several types of drivers supported by several vendors. Most popular databases like Microsoft SQL Server, Oracle, and so on do provide drivers free of charge (as a separate download or through a customized setup).
Before you start working with JDBC, you’ll need a copy of the Java JDK. JDBC is automatically installed with the latest JDK (or even NetBeans IDE). Once you have the JDK, the next thing you need to do is get the correct JDBC driver for your database. In most cases the JDBC driver will be provided by the respective database vendor.
In this case, I would like to deal with Microsoft SQL Server. At the time of this writing, I have two famous versions of Microsoft SQL Server.
- Microsoft SQL Server 2000
- Microsoft SQL Server 2005
Any prior version of Microsoft SQL Server 2000 is not supported by Microsoft for dealing with JDBC. To work with Microsoft SQL Server 2005 using JDBC, you are required to download and install the “Microsoft SQL Server 2005 JDBC Driver” available FREE of charge at http://msdn.microsoft.com/data/jdbc/.
At the time of this writing, Microsoft SQL Server 2005 would be too new for Java developers, so I would like to demonstrate using Microsoft SQL Server 2000. To work with Microsoft SQL Server 2000 using JDBC, you are required to download and install the “Microsoft SQL Server 2000 driver for JDBC Service Pack 3” available FREE of charge at http://www.microsoft.com/downloads/details.aspx?
familyid=07287B11-0502-461A-B138-2AA54BFDC03A&displaylang=en
There are some minor differences in working with Microsoft SQL Server 2005 when compared with Microsoft SQL Server 2000. If you must use Microsoft SQL Server 2005 for your application, I suggest you go through the respective documentation (or wait for my upcoming articles).
Next: How to configure CLASSPATH to connect to Microsoft SQL Server database >>
More Java Articles
More By Jagadish Chaterjee