Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 21st, 2004, 12:07 PM
Registered User
 
Join Date: Jan 2004
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Creating and connecting in a Oracle Database

Hi for all
I would like to know how can I create a connection with a Oracle Database, creating the ODBC´s and all necessary things to do this.
Please, can anyone help me?


[]´s

Reply With Quote
  #2 (permalink)  
Old January 21st, 2004, 12:18 PM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Location: Clarksville, TN, USA.
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What are you trying to do? you could write some code, create a recordset and drop the data to excel via code.



Sal
Reply With Quote
  #3 (permalink)  
Old February 4th, 2004, 06:06 PM
Registered User
 
Join Date: Feb 2004
Location: slough, berks, United Kingdom.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The best option is to use ADO. (Active Data Objects)

Set up an ODBC DSN to your Oracle TNS name and then use the oracle ODBC test to check that you can connect to the data base. Type in "Select Sysdate from Dual" and execute it. It will return the current date and time.

the general steps in VB are to

a. Establish a connection to the Oracle Database.
b. Create a recordset in memory
c. Process each field in each record and write it to a cell on a spreadsheet.
d. Close the recordset and connection

Easy to say but how to start.

The quickest way is to use MS query. This is not ADO but will give you some idea of what is required.

Open a new work book and start by recording a macro.

Go to Data, Get External Data, New Data base query and follow the steps in the wizard. Return the data to the worksheet and then stop recording.

It will have created the connection string and the SQL in MS Query format.

In the end you will probably want to create your own SQL on the fly and pass run time parameters. You can do this with the MS query option but you would be better off reading the ADO help, the only key bit missing in the help is the connection string which has been created for you in the Macro.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Connecting to oracle database in struts Manvi Struts 3 August 7th, 2006 10:53 PM
creating SQL 2000 veiws on oracle database Shwetha SQL Server 2000 1 June 30th, 2006 06:30 AM
Connecting Oracle Database with an ASP page krisvamshi Oracle ASP 3 November 14th, 2004 04:56 PM
Exception connecting to Oracle Database with JDBC celia05es Java Databases 1 March 31st, 2004 03:42 AM
Connecting an oracle database kelitu Oracle 0 September 4th, 2003 09:18 AM



All times are GMT -4. The time now is 05:43 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.