Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VB.Net - CSV to Oracle table

Posted on 2016-11-19
4
Medium Priority
?
180 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 78

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 78

Accepted Solution

by:
slightwv (䄆 Netminder) earned 2000 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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.
Suggested Courses

926 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