|
-
Jan 9th, 2000, 04:55 AM
#1
Thread Starter
New Member
I tried the single line connection code like this
cn.Open "Provider=MSDAORA.1;Data Source=Personal Oracle7;User Id=SCOTT;Password=TIGER;"
but am getting error message like this
"Runtime error - 2147467259(80004005)
ORA-12154-TNS:Could not resolve service name"
I am using Personal Oracle 7.3.4
I think the error is in Data Source string
Please help me
thanks
[This message has been edited by ipmurali (edited 01-11-2000).]
-
Jan 10th, 2000, 03:30 AM
#2
New Member
This should work. Go into Oracle's SQL Net Easy Configuration utility and create an Alias for the Oracle Service you want to connect to. For example, you create an Alias named 'ThisAlias', using the 'named pipes' protocol, and you enter the Oracle server's name and the database instance. Now you can go into the ODBC administrator in Control Panel and create a DSN for Oracle. Choose the Oracle73 driver, then give the DSN a name and a description. Where it asks you for 'SQL Net Connect String', enter the name of the alias ('ThisAlias') that you created in the previous step. You can test the new DSN using the '32-bit ODBC TEST' utility. Assuming it works, now you can connect to the Oracle DB through ADO using a connect string of "DSN=ThisAlias, UID=sa, PWD=pwd;"
-
Jan 10th, 2000, 11:52 AM
#3
Guru
Or you can use a one line connection string here
Add reference to Microsoft ActiveX Data Objects 2.x Libarary (x = 0 or 1)
Code:
Dim rs As Recordset
Dim cn As Connection
Set cn = New Connection
cn.Open "Provider=MSDAORA.1;Data Source=ServerName;User Id=stocks;Password=stocks;"
Set rs = cn.Execute("Select * from MyTable")
Do Until rs.EOF = True
Debug.Print rs.Fields(0).Value
rs.MoveNext
Loop
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|