You are on page 1of 10

THREADS OF LIFE

(HTTP://KARANBALKAR.COM/)
S TA R T PA US E R UN BUT NE VE R S TOP!!!

0
Tweet

HO ME (HT T P ://K A R A NB A LK A R .C O M/)

A B O UT (HT T P ://K A R A NB A LK A R .C O M/A B O UT /)

C O NT A C T (HT T P ://K A R A NB A LK A R .C O M/C O NT A C T /)

FA Q (HT T P ://K A R A NB A LK A R .C
O M/FA Q /)
Like

NEW S (HT T P ://K A R A NB A LK A R .C O M/NEW S /)

Tutorial#35:Load
CSVfiledatain
Oracletableusing
ODI
Postedon J U N E 16, 2013
( H TTP ://KARAN BAL KAR. C O M/2013/06/TU TO RI AL 35
L O AD C SVF I L ED ATAI N O RAC L ETABL EU SI N G
O D I /) by KARAN BAL KAR
( H TTP ://KARAN BAL KAR. C O M/AU TH O R/KARAN BAL KAR/
)

Helloeveryone!
In todays tutorial I will show you how to transfer
your CSV file data in an Oracle database table. A
CSV(Commaseparatedvalue)filebasicallystores
tabulardata(numbersandtext)inplaintextform.It
is a common and simple file format used by many
applications.

(http://feeds.feedburn
er.com/karanbalkar)
Feed
(http://karanbalkar.co
m/)
Tutorial#100:The
SwitchfromKitKatto
Lollipop!
(http://feedproxy.googl
e.com/~r/karanbalkar/
~3/NRlTMehsts/)
Tutorial#99:Sende
mailusingJavaMailin
JSP
(http://feedproxy.googl
e.com/~r/karanbalkar/
~3/SGWEFwMeaA/)
Tutorial#98:Calling
webservicesusing
PL/SQLinOracle
(http://feedproxy.googl
e.com/~r/karanbalkar/
~3/UNhHZeodEpY/)

Prerequisites:Oracledatabase10gExpressEdition
with *SQLPlus, Oracle Data Integrator (build version
11.1.1.0.7)

JoinmeonFacebook

First, you need to create your .csv file. Open


notepadandwritethefollowing!

ThreadsOfLifebyKaran
Balkar
Like

EMPLOYEE_ID,FIRSTNAME,LASTNAME
1,Dean,Winchester
2,John,Winchester
3,Sam,Winchester

380peoplelikeThreadsOfLifebyKaranBalkar

Savethefilewithfilenameasemployee.csv
Next we need to create a corresponding table in
Oracle to store this information. Open *SQLPlus and
login with your credentials. Create table using
followingcommand!
createtablecsv_test(empidintprimarykey,firstnamevarchar(
Thedatainthistablewillcomefromthe.csvfilethat

Facebooksocialplugin

wewillloadusingOracleDataIntegrator.
Now,openODIStudioandfollowthebelowsteps!
Step1:Createnewdataserver,physicalschemafor
CSVfile
Under

Topology

navigator,

go

to

Physical

Architecture, expand Technologies, right click the


FiletechnologyandselectnewDataServer.

FavoriteLinks
AndroidDevelopers
Blog(http://android
developers.blogspot.in/
)
AnotherStupidCoder's
Blog
(http://srivatsaniyer.bl
ogspot.in/)
CodingHorror
(http://www.codinghor
ror.com/blog/)

(http://karanbalkar.com/2013/06/tutorial
35loadcsvfiledatainoracletableusing
odi/data_server_1/)
Createnewdataserverandphysicalschema

ExperienceThe
Creativity
(http://sarangasl.blogs
pot.in/)
ManasGajare'sBlog
(http://manasgajare.co
m/)
TheGlobalPanorama
(http://theglobalpanora
ma.com/)

BlogStats

(http://karanbalkar.com/2013/06/tutorial35load
csvfiledatainoracletableusing
odi/data_server_2/)

Visitstoday:1928

RecentPosts
Tutorial#100:The
SwitchfromKitKatto
Lollipop!
(http://karanbalkar.co
m/2014/12/tutorial
100theswitchfrom
kitkattolollipop/)

(http://karanbalkar.com/2013/06/tutorial35load
csvfiledatainoracletableusing
odi/physical_schema/)
While creating your Physical Schema, you need to
specifythelocationwhereyour.csvfileexists.Inmy
case

the

file

is

located

at

C:\programs\java_documents\uploads
Step2:CreatelogicalschemaforCSVfile

(http://karanbalkar.com/2013/06/tutorial
35loadcsvfiledatainoracletableusing
odi/logical_schema/)
createlogicalschema

Step3:CreatedatamodelforCSVfile
UnderDesignertab,gotoModelsandcreateanew
Model folder. Then create two models, one for the
CSVfileandtheotherfortheOracletable.

Tutorial#99:Sende
mailusingJavaMailin
JSP
(http://karanbalkar.co
m/2014/12/tutorial99
sendemailusing
javamailinjsp/)
Tutorial#98:Calling
webservicesusing
PL/SQLinOracle
(http://karanbalkar.co
m/2014/12/tutorial98
callingwebservices
usingplsqlinoracle/)
Tutorial#97:Generate
multilanguagePDF
usingiTextinJava
(http://karanbalkar.co
m/2014/12/tutorial97
generatemulti
languagepdfusing
itextinjava/)
Tutorial#96:
Implementmulti
languagesupportin
Android
(http://karanbalkar.co
m/2014/12/tutorial96
implementmulti
languagesupportin
android/)

(http://karanbalkar.com/2013/06/tutorial35load
csvfiledatainoracletableusingodi/model1_1/)

(http://karanbalkar.com/2013/06/tutorial35load
csvfiledatainoracletableusingodi/model1_2/)
Right click the created csv data model and select
NewDataStore

(http://karanbalkar.com/2013/06/tutorial35load
csvfiledatainoracletableusingodi/data_store_1/)

(http://karanbalkar.com/2013/06/tutorial35load
csvfiledatainoracletableusingodi/data_store_2/)

(http://karanbalkar.com/2013/06/tutorial
35loadcsvfiledatainoracletableusing
odi/data_store_3/)
Createdatastore

Note: The comma in Field Separator is added


because it is a CSV file, and the double quotation
mark in Text Delimiter is required because the

RecentComments
HoussemonTutorial
#22:GeneratePDF
usingDroidTextin
Android
(http://karanbalkar.co
m/2013/05/tutorial22
generatepdfusing
droidtextin
android/#comment
12007)
KaranBalkar
(http://karanbalkar.co
m)onTutorial#22:
GeneratePDFusing
DroidTextinAndroid
(http://karanbalkar.co
m/2013/05/tutorial22
generatepdfusing
droidtextin
android/#comment
12005)
KaranBalkar
(http://karanbalkar.co
m)onTutorial#41:
UsingAlarmManager
andBroadcastReceiver
inAndroid
(http://karanbalkar.co
m/2013/07/tutorial41
usingalarmmanager
andbroadcastreceiver
inandroid/#comment
12004)
KaranBalkar
(http://karanbalkar.co
m)onTutorial#92:
LiveStreamingusing
VitamioinAndroid
(http://karanbalkar.co
m/2014/11/tutorial92
livestreamingusing
vitamioin
android/#comment
12003)
KaranBalkar
(http://karanbalkar.co

contents have
Winchester).

comma

(example:

1,

Dean,

In a similar manner, create model for the Oracle


tablebytheusualreverseengineeringmethod!

(http://karanbalkar.com/2013/06/tutorial
35loadcsvfiledatainoracletableusing
odi/model2/)
createmodelfortable

Step4:Createnewinterface

m)onTutorial#41:
UsingAlarmManager
andBroadcastReceiver
inAndroid
(http://karanbalkar.co
m/2013/07/tutorial41
usingalarmmanager
andbroadcastreceiver
inandroid/#comment
12002)

Tags
accelerometer, agent,

android,

androidlollipop, angular

js, animation,

Finally,createanewinterfacenamedcsv_test.LKM

birthday, c++,

used is File to Oracle (SQLLDR) and IKM Oracle

event, friendship,
goldengate, google,

IncrementalUpdate.

googlemaps, HTML5,
iText,

java, Java

EE, jQuery, json,

jython, kivy, life,

(http://karanbalkar.com/2013/06/tutorial35load
csvfiledatainoracletableusingodi/interface_14/)

memories, milestone,
MySQL, network,
notification,
openCV,

ODI,

oracle,

PDF, PhoneGap, plsql,

processing, python,
qt, qt5,

sony, tool,

tools, web, website,

widget, windows,
xml,

(http://karanbalkar.com/2013/06/tutorial35load
csvfiledatainoracletableusingodi/interface_24/)

Categories
Personal
(http://karanbalkar.co
m/category/personal/)

Tech
(http://karanbalkar.co
m/category/tech/)

(http://karanbalkar.com/2013/06/tutorial35load

TipsAndTricks
(http://karanbalkar.co
m/category/tipsand
tricks/)

csvfiledatainoracletableusingodi/interface_34/)

Archives
December2014
(http://karanbalkar.co
m/2014/12/)
November2014
(http://karanbalkar.co
m/2014/11/)

(http://karanbalkar.com/2013/06/tutorial
35loadcsvfiledatainoracletableusing
odi/interface_4/)
Createnewinterface

Run the interface. Check the status of the operation


undertheOperatortab.Ifeverythingworksfineyou
shouldnowseethedatainsertedsuccessfullyinyour
Oracletable.

October2014
(http://karanbalkar.co
m/2014/10/)
September2014
(http://karanbalkar.co
m/2014/09/)
August2014
(http://karanbalkar.co
m/2014/08/)
July2014
(http://karanbalkar.co
m/2014/07/)

(http://karanbalkar.com/2013/06/tutorial
35loadcsvfiledatainoracletableusing
odi/output_14/)

June2014
(http://karanbalkar.co
m/2014/06/)

Output

May2014
(http://karanbalkar.co
m/2014/05/)
March2014
(http://karanbalkar.co
m/2014/03/)

(http://karanbalkar.com/2013/06/tutorial35load
csvfiledatainoracletableusingodi/output_22/)

February2014
(http://karanbalkar.co
m/2014/02/)

That completes another ODI tutorial. Stay tuned for


more!

January2014
(http://karanbalkar.co

AboutKaranBalkar

m/2014/01/)
December2013
(http://karanbalkar.co
m/2013/12/)

(http://karanbalkar.com/author/Karan
Balkar/)
selfproclaimedextraterrestrialfandroid,computer
engineer,amateurgameranddiehardpunkrock
fan!
Facebook
(https://www.facebook.com/karan.balkar)Twitte
r(https://twitter.com/karanbalkar)Linkedin
(http://in.linkedin.com/pub/karan
balkar/33/722/559)Google
(https://plus.google.com/+KaranBalkar)

Thisentrywaspostedin Tech
(http://karanbalkar.com/category/tech/) andtagged csv
(http://karanbalkar.com/tag/csv/) , ODI
(http://karanbalkar.com/tag/odi/) , oracle
(http://karanbalkar.com/tag/oracle/) .Bookmarkthe permalink
(http://karanbalkar.com/2013/06/tutorial35loadcsvfiledata
inoracletableusingodi/) .

P REVIOU S
(HTTP ://KARANBALKAR. COM/2013/06/TU TORIAL
34U SING G OOG LEMAP SANDROIDAP IV2/)
NEXT
(HTTP ://KARANBALKAR. COM/2013/06/U P LOAD
FILEU SING SERVLETSJSP INJAVA/)

4thoughtsonTutorial#35:LoadCSVfiledata
inOracletableusingODI

dinesh
June26,2013at5:23pm
(http://karanbalkar.com/2013/06/tutorial35
loadcsvfiledatainoracletableusing
odi/#comment312)
howwillIloadacsvfilethathasmultiple
doublequoteinthetext

November2013
(http://karanbalkar.co
m/2013/11/)
October2013
(http://karanbalkar.co
m/2013/10/)
September2013
(http://karanbalkar.co
m/2013/09/)
August2013
(http://karanbalkar.co
m/2013/08/)
July2013
(http://karanbalkar.co
m/2013/07/)
June2013
(http://karanbalkar.co
m/2013/06/)
May2013
(http://karanbalkar.co
m/2013/05/)
April2013
(http://karanbalkar.co
m/2013/04/)
March2013
(http://karanbalkar.co
m/2013/03/)
February2013
(http://karanbalkar.co
m/2013/02/)
January2013
(http://karanbalkar.co
m/2013/01/)
November2012
(http://karanbalkar.co
m/2012/11/)
October2012
(http://karanbalkar.co
m/2012/10/)

foreg.
EMPNO,EMPNAME,Country
22,TomCruise,US
30,BradPitt,US
canthisfilebeloadedusingODI
R E PLY (/ 2 0 1 3 / 0 6 / TUTOR IA L3 5
LOA DCS VFILE DA TA INOR A CLE
TA BLE US INGODI/ ?
R E PLYTOCOM= 3 1 2 # R E S POND)

KaranBalkar
(http://karanbalkar.com)
June26,2013at9:10pm
(http://karanbalkar.com/2013/06/tutorial
35loadcsvfiledatainoracletableusing
odi/#comment313)
sointhatcasedoyouwanttostore
thenameasTomCruise(withthe
quotes)insidethedatabaseorjust
TomCruise?Ifyouwanttostorethe
nameTomCruiseinthedatabase
justspecifytextdelimiteras(two
singlequotes).
Itriedwiththissample:
22,TomCruise,US
30,BradPitt,US
R E PLY (/ 2 0 1 3 / 0 6 / TUTOR IA L
3 5 LOA DCS VFILE DA TA IN
OR A CLE TA BLE US INGODI/ ?
R E PLYTOCOM= 3 1 3 # R E S POND)

Dinesh
June26,2013at9:48pm
(http://karanbalkar.com/2013/06/tutorial35
loadcsvfiledatainoracletableusing
odi/#comment315)
CSVText
EMPNO,EMPNAME,Country
22,TomCruise,US
30,BradPitt,US
50,Jesica,Alba,US
therequireformatindatabaseis
EMPNO,EMPNAME,Country
22,TomCruise,US
30,BradPitt,US
50,Jesica,Alba,US
ietheinsidethetextremains.
IwasreadingsomeRFCforCSVfile.Itseems
ahastobeescapedinaCSVfilethatis
optionallyhavingtextenclosedin
ie..
50,Jesica,Alba,USinthecsvfilewillbe
treatedas
50,Jesica,Alba,US.antestonexcelworks
well.,

September2012
(http://karanbalkar.co
m/2012/09/)

butwhenItrytoloadthiscsvdatainto
databasewithODI.Igetadifferentbehavior
50,Jesica,Alba,US>
50,Jesica,Alba,US.anyideaaroundthis
behavior.
R E PLY (/ 2 0 1 3 / 0 6 / TUTOR IA L3 5
LOA DCS VFILE DA TA INOR A CLE
TA BLE US INGODI/ ?
R E PLYTOCOM= 3 1 5 # R E S POND)

KaranBalkar
(http://karanbalkar.com)
June28,2013at8:18pm
(http://karanbalkar.com/2013/06/tutorial
35loadcsvfiledatainoracletableusing
odi/#comment322)
Iwilltryandletyouknowaboutthis
asap!thanksforvisiting!
R E PLY (/ 2 0 1 3 / 0 6 / TUTOR IA L
3 5 LOA DCS VFILE DA TA IN
OR A CLE TA BLE US INGODI/ ?
R E PLYTOCOM= 3 2 2 # R E S POND)

LeaveaReply
Youremailaddresswillnotbepublished.Requiredfieldsare
marked
*

Name*

Email*

Website

Comment

POS T COMME NT

TH R EA D S O F L IF E

You might also like