Tuesday, June 26, 2012

Connecting MS SQL Server Database From Oracle JDeveloper 11g

This post addresses connectivity issue to Microsoft SQL Server Database 2008 from JDeveloper 11g.

Platform - Win 7 x86 Enterprise
MS SQL Server 2008 Database Engine
JDeveloper 11.1.1.3

Oracle JDeveloper 11g uses JDBC 4.0 to connect with RDBMS since JDK1.6 supports JDBC4.0 & JDeveloper uses JDK 1.6 to compile all its classes.
ojdbc6.jar classes to support basic functionality for the Thin and OCI drivers when using JDK 1.6 (JSE6) with Oracle database. Additional jar files are required when you use some features. See Oracle JDBC FAQ .

Well, that was of Oracle Database. MS SQL Server provides SQLJDBC4.jar class library, which provides support for JDBC 4.0. If you dont have this jar files, you won't be able to connect to MSSql server database. You can download from Microsoft.

1. Download sqljdbc4.jar from microsoft & save in filesystem.

2. Open JDeveloper & register the library file from Tool > Manage Libraries.

3. Click 'New' button by keep selecting 'User' Node.

4. In the 'Create Library' dialog click 'Add Entry' & locate your sqljdbc4.jar file & click 'Select' .

5. Optionally, you can check 'Deployed by default'.


managelibrary

6. Click OK.

7. Now, you are ready to establish connection to MSSQL Server.

8. Make sure your sqlserver engine is running & the account you are going to use for connect, is not
    locked.

9. From Database Navigator, create a new connection.

10.Next Screenshots are self explanatory except for 'Library' field where click 'Browse' & locate the jar file
     from 'Select Library' dialog.


selectLibrary

ConnectionDialog

































11. Click Test Connection to test the connection.