Oracle connection string with IP address

G

Guest

I can connect to a remote SQL Server database via an IP address by using a connection string such as: "Data Source=190.190.200.100,1433;..." where 1433 is the port to use (1433 is the default).

If I use the Microsoft Managed Provider for Oracle, is it possible to connect to a remote Oracle database via an IP address by using a similar connection string such as: "Data Source=190.190.200.100,1521;..." where 1521 is the port? If I understand correctly, 1521 and 1526 are the Oracle listener counterparts to the 1433.

If not, what is the proper connection string syntax to connect to a remote Oracle database?

Thanks ...
 
R

Roy Fine

The tnsnames.ora file is used by sqlnet to map a net service name alias to
these two components:
1. the connection data
2. network address

These two components are required to:
1. locate a listener (i.e. the host, port, and protocol)
2. identify a specific database instance (i.e. the service name)

If you do not want to use the tnsnames.ora file (and you will get a
millisecond or so performance boost if you don't), you can specify the
parameters directly.

If you routinely specify a net service name of myservice.myorg.com, and if
the entry in the tnsnames.ora file looks something like this:
MYSERVICE.MYORG.COM=
(DESCRIPTION =
(ADDRESS=(PROTOCOL=TCP)(HOST=121.9.9.30)(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=HRPROD.MYORG.COM)
)

then anywhere you use this in a connection string:
Data Source=myservice.myorg.com;

you can use the more verbose form of:
Data Source=(DESCRIPTION =
(ADDRESS=(PROTOCOL=TCP)(HOST=121.9.9.30)(PORT=1521))(CONNECT_DATA=(SERVICE_N
AME=HRPROD.MYORG.COM))

The SERVICE_NAME= parameter is for Oracle 8i and later. Prior versions use
the older naming syntax of SID=xxxx. In any case, the SERVICE_NAME value
must
match one of the service names listed SERVICE_NAMES parameter in the
database instance parameter file.

i hope this helps...

regards
roy fine


RonF said:
I can connect to a remote SQL Server database via an IP address by using a
connection string such as: "Data Source=190.190.200.100,1433;..." where
1433 is the port to use (1433 is the default).
If I use the Microsoft Managed Provider for Oracle, is it possible to
connect to a remote Oracle database via an IP address by using a similar
connection string such as: "Data Source=190.190.200.100,1521;..." where
1521 is the port? If I understand correctly, 1521 and 1526 are the Oracle
listener counterparts to the 1433.
 
R

Ron Fluegge

Roy,

I had found only one reference on the web to a similar solution, but wasn't
nearly as detailed and I wasn't sure if it would work.

Thanks for the information and confirmation.

It is very much appreciated.

Ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top