Solved

VB.Net - CSV to Oracle table

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
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.
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 restore a database from backup after a simulated disk failure using RMAN.

932 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

13 Experts available now in Live!

Get 1:1 Help Now