Wrox Programmer Forums
|
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 3rd, 2003, 05:23 PM
Authorized User
 
Join Date: Jun 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default Visual Basic + Oracle

Does Visual Basic + Oracle + ADO work together well?

Or is ODBC the answer? I need to connect to an oracle database on a seperate machine from a Win2K server using Visual Basic.

Can someone point me in the right direction?

M
 
Old July 5th, 2003, 08:54 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jlick
Default

VB and Oracle work well together. By using ADO, you are on the right track. You should install the oracle client (from Oracle), and choose the oracle Data Provider from Oracle, not from Microsoft. You should only use ODBC if there is a corporate mandate to do so. By adding the ODBC layer into the mix, you are slowing things down.

If you have never worked with Oracle, don't worry too much it is very similar to MS-SQL, but you will have to convert dates. I believe the command is to_date() but you will have to lookup the syntax.


John R Lick
[email protected]
 
Old July 9th, 2003, 11:59 AM
Authorized User
 
Join Date: Jun 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What would the connection string of the ADO Connection object look like?

Currently for MS-SQL:
Provider=SQLOLEDB.1
Persist Security Info=False
UserID=<USERID>
PWD=<PASS>
Initial Catalog=<DB_NAME>
Data Source=<SERVER>


With the Oracle 7 service, I have the ServiceName and UserName. But what would the Connection String look like?
 
Old July 9th, 2003, 12:11 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jlick
Default

Here is how you can find one:

Run VB.
In the View menu select the Data View Window. This will display a window with a tree structure, (Data Links being the root.)
right click on the data links root item and select Add a data link.
This will display the Data Link Properties window.
Choose the oracle driver you are looking for (I perfer the one from oracle over the one from Microsoft).
Click the next button. This will take you to the connection tab.
Enter the appropriate information, and click test connection.
Click OK.
Now in the Data View window, right click on the new entry (probably DataLink1) and choose properties. Your connection string will appear in the Name Property.

You can use this as a base, and edit it as need be.


John R Lick
[email protected]
 
Old July 9th, 2003, 12:59 PM
Authorized User
 
Join Date: Jun 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This works good for databases on Oracle 8. But what do I need different for Oracle 7? Should I install the Oracle 7 Client as well? Are the Oracle ODBC Drivers different?
 
Old July 9th, 2003, 02:26 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jlick
Default

I can't say if it would be different for Oracle 7, but I would expect it would be (at least the provider). What I have done in the past is have a setup program that calls up the same window, and store the connection string (without user & password) in the registry. That way your code doesn't have to care about the string, which will be created based on the oracle client that the client computer has.

I don't have access to the code to call up that window from VB, but if you are interested, please respond, and I will look it up when I get home from work. (Hopefully I still have that code.)



John R Lick
[email protected]
 
Old August 7th, 2003, 11:52 AM
Registered User
 
Join Date: Jun 2003
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

How can I make Oracle connection with the help of batch file. I want my tables to be created in Oracle from a batch file.

Is there any way out ???





Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Basic monika.vasvani VB Databases Basics 5 June 16th, 2014 10:01 AM
visual basic 6.0 flowertear Pro VB 6 3 June 28th, 2013 03:16 PM
visual basic khandangoll Beginning VB 6 1 October 6th, 2006 04:05 PM
FTP in Visual Studio 2005 Pro (Visual Basic) shoopes VB How-To 1 June 29th, 2006 02:08 PM
Visual Basic 6.0 Danielvb VB How-To 1 June 9th, 2003 04:30 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.