0

I have two databases on the same server with the same name and different port number. The tnxnames.ora entry looks like (actually one database is a clone of the other one.)

AAAA.FSA.GOV.UK =
(DESCRIPTION =
(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(Host = SERVERNAME)(Port = 1530)))
(CONNECT_DATA = (SID = AAAA)))


AAAA.FSA.GOV.UK =
(DESCRIPTION =
(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(Host = SERVERNAME)(Port = 1521)))
(CONNECT_DATA = (SID = AAAA)))

I am using MS-Access to develop the application and using ADODB connectivity to access the server. I am try to access the data from the server. My connection string is look like:

sConStr = "Driver={oracle in oraclient10g_home1};SERVER=SERVER_NAME;DBQ=AAAA;UID=username;Pwd=pswd"

Set oConn = New ADODB.Connection

oConn.connectionstring = sConStr
oConn.open

My problem is, my ADODB always connect to database port number 1530. I am not able to set it in the connetion string to access the database in the port 1521.

Is it possible to mention the port number in the connection string to access different database with the same name and in the same server?

I need to prepare the application to access the cloned database instead of original one. Nothing but the port number is different between the databases.

1
  • Hi, I am managed to resolve this problem. There is a different connection string is available for ADODB connectivity. DNS less connection. I used that, and mentioned the tnsnames entry in the same connectionstring itself that helps me to connect to the database. Commented Aug 26, 2009 at 11:01

3 Answers 3

1

You may find this useful: http://www.connectionstrings.com/oracle

Sign up to request clarification or add additional context in comments.

3 Comments

Absolutely, connectionstrings.com is your friend!
i have checked in that.. i am using "Oracle in OraClient10g" driver and the same in not listed in that. I accept Oracle in OraHome92 (Driver={Oracle in OraHome92};Dbq=myTNSServiceName;Uid=myUsername;Pwd=myPassword;) setting is similar to mine, but in my case, myTNSServiceName is same for both the database.
From this site, I got the DNS less connectionstring and I am able to achieve what i needed.
0

Try adding your port number to the end of the server name separated by a colon.

SERVER=SERVER_NAME:1521

I'm not an Oracle user, but that will work with MS SQL Server.

1 Comment

this setting takes server name but not recognise the port number!
0

This may be a dumb question... but are both of those entries in your tnsnames.ora?

AAAA.FSA.GOV.UK =
(DESCRIPTION =
(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(Host = SERVERNAME)(Port = 1530)))
(CONNECT_DATA = (SID = AAAA)))


AAAA.FSA.GOV.UK = 
(DESCRIPTION = 
(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(Host = SERVERNAME)(Port = 1521)))
(CONNECT_DATA = (SID = AAAA)))

Try changing it so each name is unique.

AAAA.FSA.GOV.UK =
(DESCRIPTION =
(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(Host = SERVERNAME)(Port = 1530)))
(CONNECT_DATA = (SID = AAAA)))


AA21.FSA.GOV.UK = 
(DESCRIPTION = 
(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(Host = SERVERNAME)(Port = 1521)))
(CONNECT_DATA = (SID = AAAA)))

Then on the command line try tnsping AAAA.FSA.GOV.UK and tnsping AAAA21.FSA.GOV.UK

1 Comment

I have tried that too. But the ADODB connection is always connecting to the first database since both databases are having the same username and password. I am not sure the Ports are being recognised by the ADODB connectivity.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.