Thursday, May 10, 2012

Connect Eclipse IDE to Oracle DB using TNS configuration file

Check new series of the articles. Review and user experience on test management systems. Functionality and usability.
-------------------

If you work with Oracle RDBMS you probably use the SQL IDE like Oracle SQL Developer however some may want to use old and reliable Eclipse IDE. Lets look how to configure it to access oracle DB. We'll do that using the configs from so called TNSNames.ora file.

So open that file. You should find your database description there. It should look like this:
oracle TNSNames.ora example


You need the information highlighted with yellow.
Now open Eclipse IDE and enable 'Data Source Explorer' view. In that view right click on 'Database Connections' and choose 'New...'
Eclipse Data Source Explorer view

Choose Oracle from the vendor list, specify name and description and proceed with Next button
Eclipse New Connection Profile settings (Oracle TNS)
Set up your driver so that it is Oracle Thin Driver. Specify corresponding JDBC jar file for that.
Set up the server name, port number and SID. Also specify your credentials so that DB server can authenticate you. Your connection URL should now look like this
jdbc:oracle:thin:@1.2.3.4:1521:SAMPLE
Okay. Once your connection test is passed you may finish configuring and use it from corresponding view.
Eclipse IDE Oracle connection established TNS