Asdfasf

Monday, October 08, 2012

Oracle SID vs SERVICE_NAME

If you connect to ORACLE with SERVICE_NAME, you should define it as below


MADDB=
  (DESCRIPTION=
    (ADDRESS=
      (PROTOCOL=TCP)
      (HOST=172.28.106.152)
      (PORT=1552)
    )
    (CONNECT_DATA=
      (SERVICE_NAME=MADDB)
    )
  )

If you work with SID, you can define it at TOAD by clicking on checkbox while defining TNS name


which will be as below


MADDB=
  (DESCRIPTION=
    (ADDRESS=
      (PROTOCOL=TCP)
      (HOST=172.28.106.152)
      (PORT=1552)
    )
    (CONNECT_DATA=
      (SID=MADDB)
    )
  )


What about connection URL?

To connect with SERVICE_NAME:

jdbc:oracle:thin:@172.28.106.152:1552/MADDB

To connect with SID:

jdbc:oracle:thin:@172.28.106.152:1552:MADDB

For details : http://www.rojotek.com/blog/2008/01/04/oracle-sid-service_name/

No comments: