Friday, October 1, 2010

Issue when Visual Basic 6.0-Oracle Connection

This time I tried to connect my Visual Basic (VB) 6.0 and VC++ programs with Oracle 9i database, first I tried with a usual concept that the data source name implies the system name. I was tested this program on a local machine, i.e. the database and the client program was on the same machine.

My VB 6.0 Connection string was this,

"Provider=MSDAORA.1 ; Password=hr; User ID=hr ; Data Source = toshiba; Persist Security Info=True".

this resulted in an error message like,

Run-time error '2147467259 (80004005)' : ORA-12514 : TNS : listener could not resolve SERVICE_NAME given in connect descriptor.

I tried much and finally I changed the Data source as the Global database SID (ORCL) instead of system name, then I got it working. thus the resulting connection string was like this,

"Provider=MSDAORA.1 ; Password=hr; User ID=hr ; Data Source = ORCL; Persist Security Info=True".

i.e. no need to specify the system/server name when testing locally, instead only provide the SID, User ID and Password in connection string.

No comments:

Post a Comment