Connecting SQL Server 2005 JDBC to JBOSS

We have seen some questions on how to connect a SQL Server in the Windows environment to  jBoss. So I wrote a little how-to that describes just that.
It turns out that it is actually very simple.
Essentially, all that’s involved with installing the driver is:
  1. Download the jdbc driver from here; http://www.microsoft.com/downloads/details.aspx?familyid=e22bc83b-32ff-4474-a44a-22b6ae2c4e17&displaylang=en#filelist  (Scroll to the bottom of the screen)
  2. You can either download the Windows or Unix version. It does not really matter which one you use. For this example I use the Windows version.
  3. Run the downloaded exe file; this will create a directory called Microsoft SQL Server 2005 JDBC Driver in the directory you downloaded the file to.
  4. Copy the file Microsoft SQL Server 2005 JDBC Driver\sqljdbc_1.0\enu\sqljdbc.jar to your $JBOSS_HOME/server/default/lib
  5. Set your data source of your application to use the driver;

   
        DATASOURCENAME
        jdbc:sqlserver://DATABASE URL;databaseName=jboss;
        com.microsoft.sqlserver.jdbc.SQLServerDriver
        DATABASE USERNAME
        DATABASE PASSWORD
  
NOTE: Substitute DATASOURCE NAME, DATABASE-URL, DATABASE USERNAME and DATABASE PASSWORD for your local values.
And that is all there is to it. jBoss now should be able to connect to the SQL Server

No comments:

Post a Comment

Please Provide your feedback here