Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Oracle Data Control Objet in VB

Re: Oracle Data Control Objet in VB

From: Oracle <ychin_at_earthlink.net>
Date: Tue, 24 Nov 1998 19:09:59 -0500
Message-ID: <73fi29$hak$1@holly.prod.itd.earthlink.net>


Is the ODBC DNS entry for the database you are connect to is ExmapleDb or others? You must first setup this up first to access the oracle database. The configuration utility is in the control panel called 'ODBC Config'.

>I used Personal Oracle 8. I try to run the examples
>in directory \OraWin95\oo4o21\vb\samples\ . They are about how to use
Oracle
>Data Control Object in Visual Basic. But when I run these examples, I
always
>get an error message box which displays "Unable to make connection,
ORA-12154:
>TNS:could not resolve service name".
>
> I encoutered the same problem when I copy the following code from Oracle
>Objects for OLE 2.1 help file. I failed to run it, again an Error Message
box
>displayed "Unable to make connection, ORA-12154:TNS: could not resolve
service
>name" when the statement "Set OraDatabase = OraSession.DbOpenDatabase
>("ExampleDb", "scott/tiger", 0&) was executed.
>
>
>Sub Form_Load ()
>
> 'Declare variables as OLE Objects.
> Dim OraSession As Object
> Dim OraDatabase As Object
> Dim OraDynaset As Object
>
> 'Create the OraSession Object.
> Set OraSession = CreateObject("OracleInProcServer.XOraSession")
>
> 'Create the OraDatabase Object by opening a connection to Oracle.
> Set OraDatabase = OraSession.DbOpenDatabase("ExampleDb", "scott/tiger",
0&)
>
> 'Display the username and database to which you have connected.
> MsgBox "Connected to " & OraDatabase.Connect & "@" &
OraDatabase.DatabaseName
>
>End Sub
>
>
>Would any one do me a favor? Thank you so much.
>
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Received on Tue Nov 24 1998 - 18:09:59 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US