Solved

VB.Net - CSV to Oracle table

Posted on 2016-11-19
4
29 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now