Introduction Mostly we make a connection to Oracle using JDBC through SID. Recently I have to make a connection to Oracle using Service Name. I am writing this post to share my experience. SID Connection String jdbc:oracle:thin:@IP:1521:SID Service Name connection String jdbc:oracle:thin:@(description=(address=(host=IP)(protocol=tcp)(port=1521))(connect_data=(service_name=UR_SERVICE_NAME))) Replace Service Name and host address per your configuration These strings work both for plain JDBC and hibernate. For hibernate configuration, put the above string inside <property name="connection.url">Above connection String</property> tag of hibernate.cfg.xml. Conclusion In this post, we learn how to connect to Oracle using both SID and Service Name. Happy learning
Blog about programming