About CSV File
Hi,
I want to know how to read CSV file and same sholud be saved into database. The CSV file has column name. And each column has its own value. So how to read that column name and particular column value and saved into the database..
In servlet, even i written like
pst.executeUpdate("load data infile '"+CSV_filename+"' into table Table_name fields terminated by '"+,+'" lines terminated by '"+\n+"'");
But getting error..
Can you please help me out as soon as possible....
Stop with reposting the same question over all places.
[http://forums.sun.com/thread.jspa?threadID=5374913&messageID=10649432#10649432]
[http://forums.sun.com/thread.jspa?threadID=5374930&messageID=10649514#10649514]
[http://forums.sun.com/thread.jspa?threadID=5374932&messageID=10649519#10649519]
[http://forums.sun.com/thread.jspa?threadID=5374933&messageID=10649556#10649556]
[http://forums.sun.com/thread.jspa?messageID=10649561#10649561]
Similar Messages
-
Hi all,
I want some clarification about CSV file. we using CSV file to upload data from us front end site to db(oracle db). First we read data from CSV file via java CSV reader, the problem is starts from here. The CSV file may be contain some foreign character (i.e. chines, Spanish, Japanese, hindi, arabic), We need to create the CSV file as UTF-8 format.So,
Step - 1 :we create a excel file and save as CSV format
Step - 2 the same file in open Edit+ and change the utf-8
Mean the file has been read in java CSV reader.
Otherwise suppose i changed the second step that is the file open in notepad and convert utf-8 mean this same file not recognized to read in java CSV reader
Please give some idea how to create CSV file in UTF-8 charsetIf your input file is in csv format, try importing it directly into the database using SQLDeveloper. If you have a table created already, riight click on the table in the Connections navigator and select import data. On the first page of the wizard, select the correct encoding from the Encoding list. You should see the characters in the file displayed correctly in the bottom of the page. Select the other options like format, delimiiters and line terminators. When these options are specified correctly, you should see the file displayed as rows and columns in the bottom of the screen. Continue with the import using the wizard. If the table is not already created, you can right click on the table folder in the Connections navigator. The second page of the wizard will allow you to enter a new table name, the wizard will automatically create a column in the table for each column in the file and you can refine the column definitions using step 4, the Column Definition panel.
Joyce Scapicchio
SQLDeveloper Team -
Question about reading csv file into internal table
Some one (thanks those nice guys!) in this forum have suggested me to use FM KCD_CSV_FILE_TO_INTERN_CONVERT to read csv file into internal table. However, it can be used to read a local file only.
I would like to ask how can I read a CSV file into internal table from files in application server?
I can't simply use SPLIT as there may be comma in the content. e.g.
"abc","aaa,ab",10,"bbc"
My expected output:
abc
aaa,ab
10
bbb
Thanks again for your help.Hi Gundam,
Try this code. I have made a custom parser to read the details in the record and split them accordingly. I have also tested them with your provided test cases and it work fine.
OPEN DATASET dsn FOR input IN TEXT MODE ENCODING DEFAULT.
DO.
READ DATASET dsn INTO record.
PERFORM parser USING record.
ENDDO.
*DATA str(32) VALUE '"abc",10,"aaa,ab","bbc"'.
*DATA str(32) VALUE '"abc","aaa,ab",10,"bbc"'.
*DATA str(32) VALUE '"a,bc","aaaab",10,"bbc"'.
*DATA str(32) VALUE '"abc","aaa,ab",10,"b,bc"'.
*DATA str(32) VALUE '"abc","aaaab",10,"bbc"'.
FORM parser USING str.
DATA field(12).
DATA field1(12).
DATA field2(12).
DATA field3(12).
DATA field4(12).
DATA cnt TYPE i.
DATA len TYPE i.
DATA temp TYPE i.
DATA start TYPE i.
DATA quote TYPE i.
DATA rec_cnt TYPE i.
len = strlen( str ).
cnt = 0.
temp = 0.
rec_cnt = 0.
DO.
* Start at the beginning
IF start EQ 0.
"string just ENDED start new one.
start = 1.
quote = 0.
CLEAR field.
ENDIF.
IF str+cnt(1) EQ '"'. "Check for qoutes
"CHECK IF quotes is already set
IF quote = 1.
"Already quotes set
"Start new field
start = 0.
quote = 0.
CONCATENATE field '"' INTO field.
IF field IS NOT INITIAL.
rec_cnt = rec_cnt + 1.
CONDENSE field.
IF rec_cnt EQ 1.
field1 = field.
ELSEIF rec_cnt EQ 2.
field2 = field.
ELSEIF rec_cnt EQ 3.
field3 = field.
ELSEIF rec_cnt EQ 4.
field4 = field.
ENDIF.
ENDIF.
* WRITE field.
ELSE.
"This is the start of quotes
quote = 1.
ENDIF.
ENDIF.
IF str+cnt(1) EQ ','. "Check end of field
IF quote EQ 0. "This is not inside quote end of field
start = 0.
quote = 0.
CONDENSE field.
* WRITE field.
IF field IS NOT INITIAL.
rec_cnt = rec_cnt + 1.
IF rec_cnt EQ 1.
field1 = field.
ELSEIF rec_cnt EQ 2.
field2 = field.
ELSEIF rec_cnt EQ 3.
field3 = field.
ELSEIF rec_cnt EQ 4.
field4 = field.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
CONCATENATE field str+cnt(1) INTO field.
cnt = cnt + 1.
IF cnt GE len.
EXIT.
ENDIF.
ENDDO.
WRITE: field1, field2, field3, field4.
ENDFORM.
Regards,
Wenceslaus. -
About the character-code of the csv file
Hi All
The csv file is made by using the Write_File action.
Is it possible to make it by character-code "ANSI"?
Any assistance would be appreciated.
Thanks,
hikedaguorke,
I suggest you add userlog to the server to see the tpreturn situation and compare with tpcall's return code. iSucess is -1 means something wrong, other values such as 64, 128... means the tpcall's execution scucessfully and they are code related with internal handler index.
Wayne -
Sender "Mail" adapter - CSV file attachment
Hi there
I'm looking for some help in configuring a sender mail adapter that receives ".csv" files. I did read some blogs that mention using the "PayloadSwapBean" module to read the mail attachment instead of the mail content. My problem is to now convert the ".csv" file into a message. Is there a module that I can use ( is it the "MessageTransfomBean" ) and how. Any help would be appreciated.
Thanks
SalilHi Salil,
If you want to send a mail with a body and attachments, the message sender HAS to provide an XI message with attachments. I doubt a CSV file does justice.
As Renjith said you need to convert CSV to XmL.
A short description about the Standard Modules:
MessageTransformationBean is a standard module used to apply the XSLT mapping to the adapter module by using <i>Transform.class</i> ( This xslt mapping is done to create a mail package, Dont confuse with the actual mapping in your case this is NOT for converting csv to xml).
Also this module can be used to change the name and type of payloads by using <i>Transform.contentType</i>, <i>Transform.contentDisposition</i>, <i>Transform.contentDescription</i>.
PayloadSwapbean is a standard module for replacing payloads with other payloads (SWAP)
If you want to give each attachment a certain name use Parameters, <i>swap.keyname</i> for name of the payload and <i>swap.keyvalue</i>.
I Hope the use of standard modules is understood. -
How Can I Import Contacts from Excel (XLSX/XLS) and CSV file to VCF File?
Hi Friends,
I have stored my all official and personal contacts list in the Excel (XLSX/XLS) spreadsheet and CSV file from long time. But now, I want to move my all contacts in an MS outlook 2013 and also Samsung S4 Contacts directory. But for this process, I require to import all Excel and CSV file contacts into VCF file format. So that, I could export vCard (VCF) file in the outlook and Samsung S4 contacts book. But I don't know about this process that how to import Excel and CSV file contacts into vCard format. If anyone has best solution to import and export excel or CSV file contacts into VCF file, so please share with me that information.
Thanks & Best Regards
Jackson T.
<Edited By Host>https://itunes.apple.com/gb/app/csv-to-vcard/id713295900?mt=12
-
How can I import an existing csv. file into Outlook on a Mac with OS10.7
Tried to import a csv. file on my Mac (OS 10.7.2) into Microsoft Outlook 2011 (for Mac) on the same computer, ended up with a useless Excel page - it opened the csv file in Excel with only a few contacts and uselessly formatted, at that!. Also, tried to save the csv file as a text file, then importing it into Word 2011 and Excel, with the same results. Anyone able to help? Would like to have the contained address/contact info look concise and neat, without duplicates or garbled/missing information.
[email protected]DPS can use H.264 files, but I have no idea about the details since I've never done any of it myself. Ask in the ID/ DPS forums.
Mylenium -
Here is the transcript of a chat with Firefox community member zzxcon May 3/10
You are now chatting with Firefox community member zzxc
zzxc: Hello
zzxc: What happens when you attempt to download a .csv file?
seegal: hello
seegal: it doesn't copy
zzxc: how are you trying to copy?
seegal: pls bear with me I'm a slow typist. Just copy selected text
Biolizard has joined the conversation.
zzxc: ok - which text are you selecting?
seegal: I reconcile my checkbook (spreadsheet this way). I copy the items in my online bank acc and paste it to the spreadsheet
seegal: I'm using Firefox /2.0.0.19. Have no problem to do this.
zzxc: Which version of OS X?
seegal: In all newer version nothing happens when trying to paste- just doesn't paste
zzxc: Firefox 2.0.0.x is no longer supported, and hasn't been supported in over a year
zzxc: Paste into Excel, from Firefox?
seegal: Sorry, I'm ahead... /2.0.0.19
seegal: Yes. I open my bank acc in Firefox
zzxc: Which version of Excel?
zzxc: It would really help if you could tell me step by step what you're doing.
seegal: First re: your previous question: it's OS 10.4.11
seegal: About Excell: it'as 2004 version - the lasat one produced for Macs. The specific version is 11.3.7
seegal: So I open my bank acc online in Firfox (my primary browser). I copy the latest entry in the account and paste it into my Excel spreadsheet.
zzxc: so, you copy direct from the web page without downloading a CSV file?
seegal: What do you mean by downloading to CSV file? I could export from the https://chat-support.mozilla.com:9091/webchat/getimage?image=sendmessage&workgroup=support%40workgroup.chat-support.mozilla.comFirefox to the CSV file, but the other way around?
zzxc: Are you copying your bank statement directly from the web site to Excel using the clipboard?
seegal: sI don't use the clipboard. This is a mac. There is no need to do that. In PC it would be yes.
zzxc: I need to know the exact steps you're taking to get them into excel
zzxc: And I need to know what exactly goes wrong in the latest version of Firefox.
seegal: Do you have a mac there with Firefox and Excel? It would be very easy to reproduce. Imagine you open an online bank acc, select some entries , click "copy", than proceed to your already open Excel spreadsheet and click' paste". That's it!
zzxc: When this happens, do you get cryptic code pasted into Excel?
seegal: As I said before: in all newer versions starting with 3.0 when I go to Excel to "paste" from my bank acc nothing happens. It does not paste. No, I don't get a cryptic code pasted, just NOTHING.
zzxc: what if you paste into MS Word instead?
seegal: haven't tried that, the formatting most likely would be lost. Tried that with an other Exc el spreadsheet- it lost all the formating and pasted as continous text.
== This happened ==
Every time Firefox opened
== Pls. see copy of the chat above. THIS A MAC OS X. In older versions, prior to 3.0 I could copy from CSV file on the website Ibank acc) and paste directly to my Excel spreadheet to reconcile my account.See also:
Table2Clipboard: https://addons.mozilla.org/firefox/addon/1852
TableTools: https://addons.mozilla.org/firefox/addon/2637 -
Web.show_document() with .csv-Files
Hallo,
when I try to show a .csv-file using web.show_document in MS-Excel I'm facing the following problem:
Depending on the windows-settings (?) before showing the Excel-sheet the browser opens an alert 'open/save file'.
When this alert is activated the web.show-document() is not successfull, that means: it seems that the browser tries to open the new window but it immediatly 'crashes' (I'm using '_blank' as parameter).
When this alert is not activated everything works perfect.
My guess is that it has something to do with whith the javascript-problem under XP-SP2. (i also can't get javascript working together with web.show_document).
Enviroment is: Forms 10g, Windows XP SP2, MS-IE (Mozilla works fine), 10g iDS and iAS
any ideas?
tia
FrankHello,
already done, doesn't help.
The odd thing is: when I type the url web.show_document should show directely into the IE (with virtual pathname) the alert shows up, I can choose 'open' and it works (thats the way I get rid of the alert). It seems to me that showing the alert somehow causes the problem in combination with web.show_document.
I have a similar problem with javascipt. When I type it directly into the browser everything works fine, from web.show_document .. no way.
So my guess was that maybe the alert itself uses javascript. I dont know much about java and browsers and so its really only a guess.
The Alert I'm talking about is the following (modulo translation errors):
do you want to open or save the file
Name... / Type... /from....
open/save/cancel -Buttons
checkbox: always ask before opening a file of this type
Frank -
Trying to save a csv file on my ipad so I can auto populate into a SmartForm. It will only allow me to access photos when I hit the import button
search the app store for PDF Writer. I've found a lot that will convert documents to PDF, but none yet that will write within the PDF. One thing you want to avoid are cloud based apps. Any of them that talk about editing on the cloud, etc, aren't going to be as standalone as you want.
It's possible, if you can take your template PDF, turn it into a word document that you can edit, you can then convert that to PDF...kinda a workaround way to do what you want. And apps that convert to PDF are much easier to find -
I can't find anything about this online
The CSV files are send as Content-Type: text/comma-separated-values
Do you mean that you also see the file in a Firefox tab or do you get two Excel instances?
You can try to rename (or delete) the mimeTypes.rdf file in the Firefox profile folder to reset all file actions.
*http://kb.mozillazine.org/mimeTypes.rdf
*http://kb.mozillazine.org/File_types_and_download_actions#Resetting_download_actions
You can use this button to go to the currently used Firefox profile folder:
*Help > Troubleshooting Information > Profile Directory: Show Folder (Linux: Open Directory; Mac: Show in Finder) -
How do I upload a CSV file with embedded quotation marks into a table via ETL
I'm having a problem importing a CSV file via ETL that contains double-quotes, and prior solutions aren't helping. My data looks like this:
A
B114SA
CHLORASCRUB SWAB INS SUBASSEMB
A
S273SA
CHLORASCRUB MAXI INS SUBASSEMB
A
2AB286
WEB ZEE ANTISEPT 5410\4.5" CD
A
2AB512
WEB PDI PVP IODINE PREP PAD 3870/4.5
A
2AB542
WEB ZEE CLEAN WIPE NP5410/4.5
If I set the "Text Qualifier" to ' " ', then run it, it falls over on the third row, with the following error:
- Executing (Error)
Messages
Error 0xc0202055: Data Flow Task 1: The column delimiter for column "Column 2" was not found.
(SQL Server Import and Export Wizard)
Error 0xc0202092: Data Flow Task 1: An error occurred while processing file "H:\AS400_file_transfers\LIMS\ACTITEMPF.CSV" on data row 3.
(SQL Server Import and Export Wizard)
Error 0xc0047038: Data Flow Task 1: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on component "Source - ACTITEMPF_CSV" (1) returned error code 0xC0202092. The component returned a failure code when the pipeline engine
called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure.
(SQL Server Import and Export Wizard)
Any help?Full support for embedded quotes was added in SSIS 2012.
Which version are you using?
http://blogs.msdn.com/b/mattm/archive/2011/07/17/flat-file-source-changes-in-denali.aspx -
How to configure sync rules involving a CSV file and portal self service
Hello,
I need to configure some FIM sync rules for the following scenario:
User account details are entered from a HR CSV file and exported to AD Users have the ability to modify their own AD attributes in the
FIM portal (there is not a requirement for them to view their HR CSV data in the portal). The FIM portal modifications will be exported to AD as expected.
My setup is as follows:
CSV file - name, last name, employee ID, address.
CSV MA - has direct attribute flows configured in the MA between the data source and MV Portal self service attributes –
users can edit mobile, display name and photo
I've also set the CSV MA as precedent for the attributes
FIM MA – attribute flows defined for MV to Data Source as usual (i.e. firstname to firstname, accountname to accountname, etc).
AD MA – no attribute flows defined as inbound and outbound sync rules have been configured in the portal using the Set\MPR\Triple.
I’m thinking of using the following run profiles:
CSV MA – full import and delta sync (imports HR data)
FIM MA – export and delta import (imports portal changes)
FIM MA – delta sync (syncs any portal changes)
AD MA – export and delta import
If my understanding is correct this should sync HR data from CSV to AD, as well as user attribute self service updates from the portal to AD.
If I wanted to just do a HR CSV sync could I get away with just steps 1 & 4 ? (presumably not as my rules are in the FIM portal?)
If I wanted to do just a portal sync, could I get away steps 2-4?
Any advice on how to improve my setup is much appreciated - cheers
IT Support/EverythingThe truth is that your design should be done in the way that it doesn't matter which profiles in which order you will execute. At the end, if you will run all import, synch and export profiles on each data source you should get same result. This is beauty
of synch engine here.
Your steps from 1-4 will synch data to your data sources and at the end will give you expected result. But not because of the order you are executing them but because of correct attribute flows. If flows from CSV file and from FIM portal might be done for
the same attributes you need to think also about attribute precedence.
Tomek Onyszko, memberOf Predica FIM Team (http://www.predica.pl), IdAM knowledge provider @ http://blog.predica.pl -
Split records into Multiple csv files using a Threshold percentage
Hi Gurus,
I have a requirement to split the data into two csv file from a table using a threshold value(in Percentage) .
Assume that If my source select query of interface fetches 2000 records , I will provide a threshold value like 20%.
I need to generate a csv1 with 400 records(20% of 2000) and the rest of the records into another csv2.
For implementing this I am trying to use the following process.
1) Create a procedure with the select query to get the count of records.
Total Records count: select count(1) from source_table <Joins> <Lookups> <Conditions>;
2) Calculate the Record count to first CSV using the threshold_value.
CSV1_Count=Total records count /threshold_value
3) Create a view that fetches the CSV1_Count(400) records for CSV1 as follows.
Create view CSV1_view as select Col1,Col2,Col3 from source_table <Joins> <Lookups> <Conditions>
Where rownum<=CSV1_Count;
4) Generate CSV1 file using View 'CSV1_View'
5) Generate CSV2 File using the Interface with same select statement (with columns ) to generate a CSV.
select Col1,Col2,Col3 from source_table ST <Joins> <Lookups> <Conditions>
Left outer join (Select Col1 from CSV1_View ) CS on CS.Col1=ST.Col1 where CS.Col1 is null;
Which gives the Total records minus the CS1_View records.
The above process seems a bit complex and very simple . If any changes in my Interface I also need to change the procedure (counts the no:of records).
Please provide your comments and feedback about this and looking for your inputs for any new simple approach or fine tune the above approach.
Thanks,
ArjunArjun,
This are my thoughts and Lets do it in 3 Steps
Step 1. ODI Procedure
Drop table Temp_20 ;
Create table Temp_20 as select * from table where rownum < ( SELECT TRUNC( COUNT(1) /5) FROM TABLE ) .
[ ** This way iam fetching approx 20% of the table data and loading into Temp table . 1/5 th is 20% so i am dividing count by 5
I don't believe View will help you especially with RowNum as if you run the same query with rownum < N the rows order might differ . so Temp table is great ]
Step 2 . Use OdiSqlUnload with select columns from temp_20
Step 3 . Use again OdiSqlUnload with select columns from table where ( uk keys ) not in ( selecy uk_keys from temp_20)
[** this way you can pick the remaining 80% ** and the data will be not repeat itself across 20% and 80% , as might happen with view ]
what do you think ? -
Loading data from .csv file into existing table
Hi,
I have taken a look at several threads which talk about loading data from .csv file into existing /new table. Also checked out Vikas's application regarding the same. I am trying to explain my requirement with an example.
I have a .csv file and I want the data to be loaded into an existing table. The timesheet table columns are -
timesheet_entry_id,time_worked,timesheet_date,project_key .
The csv columns are :
project,utilization,project_key,timesheet_category,employee,timesheet_date , hours_worked etc.
What I needed to know is that before the csv data is loaded into the timesheet table is there any way of validating the project key ( which is the primary key of the projects table) with the projects table . I need to perform similar validations with other columns like customer_id from customers table. Basically the loading should be done after validating if the data exists in the parent table. Has anyone done this kind of loading through the APEX utility-data load.Or is there another method of accomplishing the same.
Does Vikas's application do what the utility does ( i am assuming that the code being from 2005 the utility was not incorporated in APEX at that time). Any helpful advise is greatly appreciated.
Thanks,
AnjaliHi Anjali,
Take a look at these threads which might outline different ways to do it -
File Browse, File Upload
Loading CSV file using external table
Loading a CSV file into a table
you can create hidden items in the page to validate previous records before insert data.
Hope this helps,
M Tajuddin
http://tajuddin.whitepagesbd.com
Maybe you are looking for
-
Is there an on-line ABAP OO Tutorial? If yes, can someone point me to it? Thanks!
-
Hi Experts, Can anyone explain what is reconciliation of data and why do we do that and what are the steps for that process. Pease reply.Points will be assigned. Thsnks, Sai.
-
Make MRP controller field optional
Hi Gurus, Can we make MRP controller field optional in material master for specific material type? Deepak
-
The NAI came to me while in privacy opt out setting signing up for Netflix...I need to uninstall it...I can't find where to do that on my computer. Need simple directions. use email: [email protected] as NAI is strangling my computer and takes foreve
-
I can not send messages on an iPad mini the send button stays light gray and will not send. I can receive. I reset and logged out and back inn with no results. It worked fine when we first set it up. Any suggestions?