Solved

VB.Net - CSV to Oracle table

Posted on 2016-11-19
4
88 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 77

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 77

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.

763 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