Saturday, February 9, 2013

Access SQL server through Eclipse IDE

This article explains how to make a connection to SQL server database through Eclipse IDE and view/manipulate data in Database Development perspective.

1)  First of all you have to download the database driver. In my case since I am using SQL Server 2008 R2, I should use sqljdbc4.jar  and depending on the server version the jar can change to sqljdbc.jar

2)  Then you have to add the driver definition in Eclipse preferences.
Go to Window -> Preferences -> Data Management -> Connectivity -> Driver Definitions -> Add

Select driver template



Select driver jar file


Fill in the properties


3)  Then open up the Database Development perspective




4)  Next, right click Database Connections create new connection. Select the connection profile for SQL Server, give a name for the connection and press next



Specify the driver and connection details


Here you can select the driver that we defined in step 2 and before testing the connection make sure the Remote connection via TCP/IP is enabled for SQL server and user has the permission for the connection.

You can refer to the article Enable TCP/IP remote connections for SQL server and give user permission for more details on this.

If you select Use Integrated Authentication, the connection will use windows authentication. But this will require sqljdbc_auth.dll and little bit more configurations which will not be covered in this article.

5)  So finally you can test and finalize the connection. After creating the connection you can view and manipulate table data in the SQL Server databases.





No comments:

Post a Comment