Solved

VB.Net - CSV to Oracle table

Posted on 2016-11-19
4
70 Views
Last Modified: 2016-11-28
I am stuck and looking at examples, but cannot find any good examples of how to read a csv file and loading the data into an oracle table.  Most examples I found indicate using sqlloader or toad, but I want an application so I can retrieve what's been loaded and do some data comparison for the users to review after the load.  So this VB.Net tool will allow the users to select the csv file and load into oracle table.  Most rows they will be loading is about 200 rows or less, so performance will not be an issue.

The csv file and oracle table will have the same columns/fields:

Customer Name, Address, City, State, Zipcode

The oracle table name is "CUSTOMER_ADDRESS".

Can someone with experience how to read from csv to Oracle table give me an example?
0
Comment
Question by:holemania
  • 2
  • 2
4 Comments
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 41894449
What part are you having problems with?

I would suggest using ODP.Net Managed Driver as the data access piece and not the OleDB drover from your other question.  It doesn't require an Oracle Client install and is much better, IMO:
http://www.oracle.com/technetwork/topics/dotnet/downloads/net-downloads-160392.html

Choose 32Bit or 64Bit and the Managed Client is under there.

Then it is a simple matter of read a line from the file, parse it and insert.  For 200 rows I wouldn't worry about any sort of bulk loading.

Create the insert statement with the correct parameters and go into a loop and set the parameter values to the parsed values and a quick cmd.executenonquery(), commit outside of the loop and you are done.
0
 

Author Comment

by:holemania
ID: 41895173
I was wondering how to get it to work without having to install the client.  The ODP.Net, to install that do I need to have the tsnames.ora file on the development machine?  I was able to install the client on the developer machine, and not have to use the tsnames.ora file.  I had the connection string in my vb.net application which then allows me to connect to the Oracle database.  However, trying to use the ODP.Net and when I tried running the install.bat file nothing is happening.  Would this install the required reference file I need from my application and once compiled, the user would not have to have the client installed correct?
0
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 41896712
>> The ODP.Net, to install that do I need to have the tsnames.ora file on the development machine?

No.  You can use EZConnect syntax.

>>However, trying to use the ODP.Net and when I tried running the install.bat file nothing is happening.  

By running it, do you mean double clicking on it?  It has options you need to select. manually open up a CMD prompt and run it from there.

>>, the user would not have to have the client installed correct?

You should be able to just copy the Managed Client DLL into the bin folder of the app without having to install anything.

It has been a while since I "installed" the Managed Client but I think most of what the BAT file does is set up the GAC/Registry.  As long as you copy the DLL into the correct app folder, you shouldn't need to install anything.
0
 

Author Closing Comment

by:holemania
ID: 41904574
Thanks that was helpful.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Via a live example, show how to take different types of Oracle backups using RMAN.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question