Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I use VB6 to connect to an Oracle database?

Status
Not open for further replies.

peterv12

Technical User
Dec 31, 2008
108
US
I've created an Oracle database, and I'd like to be able to write a VB6 front-end for it. I searched this forum, but didn't find any relevant information. Does anyone know if you can use VB6 to connect to an Oracle db, and if so, do you know of any simple step-by-step examples that a newbie like myself could use to learn how to do it? Thanks...
 
Have you searched MS or Oracle for an ODBC driver? If not that may be a good place to start. Then if you do not find enough information at MS's KB or Oracle's you can always go to and if you are really new to VB6 then check out the database wizards and where applicable use the code option.

Good Luck
 

"any simple step-by-step examples" look here

First part is where you can create all your SQLs, second part is about how to connect to database. In the example it is Access, but it works with ORACLE as well.

Give it a try.

Have fun.

---- Andy
 
Thanks for these replies! I'll be checking them out in detail tonight.

vb5prgmr - you said check out the database wizards. Pardon my ignorance, but can you tell me how to find/access the database wizards? (I told you I was new to VB6).
Thanks.

I'll post how it goes soon! Happy New Year!
 

Add-ins>add in manager>application wizard/dataform wizard/data object wizard are three to have fun with.

Good Luck

 
Andy,
I'm trying to follow the directions you gave me the link for, but when I substitute the oracle OLE DB provider for the ACCESS one in the tutorial, the next step only gives me the option "Use data source name", and the "Use connection string" option is grayed out. Any ideas?
 

Try to use "Microsoft OLE DB Provider for Oracle" (in DataLink Properties), then "Next>>" command button, and in "Enter a server name" you should have something like "T101" (your Oracle server name) and User name and password, if needed. Just to connect your DataEnvironment to your Oracle DB.

In code in VB 6, to connect to your Oracle DB, you should have a connection string something like:
Code:
    strCn = "Driver={Microsoft ODBC for Oracle};" & _
            "SERVER=T101;[blue]UID=MyID;PWD=MyPassWd[/blue]"
    Set Cn = New ADODB.Connection
    Cn.ConnectionString = strCn
    Cn.CursorLocation = adUseNone
    Cn.Open
If you don't have Login name and Password to your Oracle, just bypass the blue part of code.

Have fun.

---- Andy
 

peterv12, I added steps to connect to ORACLE in my original link so you can go back there and try again.

I hope it is an easy step-by-step way to follow....

Have fun.

---- Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top