CSV FILE TO DATABASE

hi,
m neame coloumns awsto java. i have a requirement.i hav a csv file .i have database table which has same coloumns as the csv field names.
i have to upload the contents of the csv file in to the table.
at present i am being able to read each line in da csv file using the readLine method and storing into array.
i have to now insert this row into the database using prepared statement.
but how do i set the values into the preared statement.
i am retrieving each row from the csv.
can anyone help me

Try http://www.aquafold.com/ Aqua Data.
It loads data from formats such as CSV and loads them
into an existing table.
Plus many other cool features.Peter, thanks for that link. Looks neat.
To the OP:
You have at least two options:
1. Use Java to load the data through a series of INSERT statements.
2. Use the bulk loader facilities found in many of todays RDBMS.
Now go do your homework.

Similar Messages

  • Error for the uploading csv file to database

    Hi i tried to upload the csv file to database and i am getting error as
    <cffile action="read" file="#data_dir_upload#/di_audit_corp_upc_ldr_tbl.csv" variable="di_audit_corp_upc_ldr_tbl">
    <!--- loop through the CSV-TXT file on line breaks and insert into database --->
    <cfloop index="index" list="#di_audit_corp_upc_ldr_tbl#" delimiters="#chr(10)##chr(13)#">
        <cfquery  datasource="#request.dsnCAO#">   
                <!--- SET ANSI_WARNINGS OFF      --->
             INSERT INTO [dbo].[di_audit_corp_upc_ldr_tbl]
                                ( cpt_dpt_cd,cpt_com_cd,sub_com_cd,con_upc_no,pid_lng_dsc_tx,pid_sht_dsc_tx)
             VALUES
                      (<cfqueryparam value='#left(trim(listgetAt('#index#',2,',')),2)#' cfsqltype="cf_sql_char">,
                       <cfqueryparam value='#left(trim(listgetAt('#index#',3,',')),3)#' cfsqltype="cf_sql_char">,
                       <cfqueryparam value='#left(trim(listgetAt('#index#',4,',')),5)#' cfsqltype="cf_sql_char">,
                       <cfqueryparam value='#left(trim(listgetAt('#index#',1,',')),13)#' cfsqltype="cf_sql_varchar">,                  
                       <cfqueryparam value='#left(trim(listgetAt('#index#',5,',')),25)#' cfsqltype="cf_sql_varchar">,
                       <cfqueryparam value='#left(trim(listgetAt('#index#',6,',')),12)#' cfsqltype="cf_sql_varchar">)    
       </cfquery>
    </cfloop>
    Error:
    An error occurred while executing DTS package to import data.
    Invalid list index 6.
    In function ListGetAt(list, index [, delimiters]), the value of index, 6, is not a valid as the first argument (this list has 5 elements). Valid indexes are in the range 1 through the number of elements in the list.
    i am unable to solve this issue can any one will help me to solve this issue
    Thanks,
    Kiran

    I take it your are trying to use a csv file to insert new data into a database, using flex and coldfusion?
    if so, then I would load the file in flex using cffile in ColdFusion and then use Load Data if you are using MySQL
    This can show you more about it.
    http://blog.tygate.com/?p=75
    We get very large csv files ftp'd to us every week, and we have to load them in to the db. this works for us.

  • Sending csv files to database

    Hi,any suggestions welcome.I have a page that gets a .CSV file for user names from the local system and sends it a servlet to parse and send to the database.I inetnd to use a servlet to parse the csv files and insert into the database.Is there any easier method of implementation,or can i use that method.
    Thanks in advance

    Databases usually have utilities which read CSV and upload data into the database. These are faster than JDBC, but that would mean using Runtime.exec(). I guess you will have to go for parsing the files and inserting the records in batches.

  • Uploading csv file into database using apex

    Dear all
    I am using apex 4 and oracle express 10g, i need to upload .csv file into the database for one of my appls, i have referred discussion forum for solutions, i found also, but some how its not working for me.
    below mentioned is error and the code
    ERROR:
    ORA-06550: line 38, column 8: PLS-00221: 'V_DATA_ARRAY' is not a procedure or is undefined ORA-06550: line 38, column 8: PL/SQL: Statement ignored ORA-06550: line 39, column 8: PLS-00221: 'V_DATA_ARRAY' is not a procedure or is undefined ORA-06550: line 39, column 8: PL/SQL: Statement ignored ORA-06550: line 40, column 8: PLS-00221: 'V_DATA_ARRAY' is not a procedure or is undefined ORA-06550: line 40, column 8: PL/SQL: Statement ignored ORA-06550: line 41, column 8: PLS-00221: 'V_DATA_ARRAY' is not a proc
    Error
    OK
    CODE:
    DECLARE
    v_blob_data BLOB;
    v_blob_len NUMBER;
    v_position NUMBER;
    v_raw_chunk RAW(10000);
    v_char CHAR(1);
    c_chunk_len number := 1;
    v_line VARCHAR2 (32767) := NULL;
    v_data_array wwv_flow_global.vc_arr2;
    BEGIN
    -- Read data from wwv_flow_files
    select blob_content into v_blob_data
    from wwv_flow_files where filename = 'DDNEW.csv';
    v_blob_len := dbms_lob.getlength(v_blob_data);
    v_position := 1;
    -- Read and convert binary to char
    WHILE ( v_position <= v_blob_len ) LOOP
    v_raw_chunk := dbms_lob.substr(v_blob_data,c_chunk_len,v_position);
    v_char := chr(hex_to_decimal(rawtohex(v_raw_chunk)));
    v_line := v_line || v_char;
    v_position := v_position + c_chunk_len;
    -- When a whole line is retrieved
    IF v_char = CHR(10) THEN
    -- Convert comma to : to use wwv_flow_utilities
    v_line := REPLACE (v_line, ',', ':');
    -- Convert each column separated by : into array of data
    v_data_array := wwv_flow_utilities.string_to_table (v_line);
    -- Insert data into target table
    EXECUTE IMMEDIATE 'insert into TABLE_X (v1, v2, v3, v4 ,v5, v6, v7,v8 ,v9, v10, v11)
    values (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11)'
    USING
    v_data_array(1),
    v_data_array(2),
    v_data_array(3),
    v_data_array(4);
    v_data_array(5);
    v_data_array(6);
    v_data_array(7);
    v_data_array(8);
    v_data_array(9);
    v_data_array(10);
    v_data_array(11);
    -- Clear out
    v_line := NULL;
    END IF;
    END LOOP;
    END;
    what i understand from this is system does not identify v_data_array as array for some reasons, please help me.
    initially system was giving error for hex_to_decimal, but i managed to get this function on discussion forum and now it seems to be ok. but v_data_array problem is still there.
    thanks in advance
    regards
    Uday

    Hi,
    Mistakes in your sample I did correct
    Problem 1
    select blob_content into v_blob_data
    from wwv_flow_files where filename = 'DDNEW.csv'; to
    select blob_content into v_blob_data
    from wwv_flow_files where name = :P1_FILE;Problem 2
    EXECUTE IMMEDIATE 'insert into TABLE_X (v1, v2, v3, v4 ,v5, v6, v7,v8 ,v9, v10, v11)
    values (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11)'
    USING
    v_data_array(1),
    v_data_array(2),
    v_data_array(3),
    v_data_array(4);
    v_data_array(5);
    v_data_array(6);
    v_data_array(7);
    v_data_array(8);
    v_data_array(9);
    v_data_array(10);
    v_data_array(11);  to
    EXECUTE IMMEDIATE 'insert into TABLE_X (v1, v2, v3, v4 ,v5, v6, v7,v8 ,v9, v10, v11)
    values (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11)'
    USING
    v_data_array(1),
    v_data_array(2),
    v_data_array(3),
    v_data_array(4),
    v_data_array(5),
    v_data_array(6),
    v_data_array(7),
    v_data_array(8),
    v_data_array(9),
    v_data_array(10),
    v_data_array(11);  And I did create missing table
    CREATE TABLE TABLE_X
        v1  VARCHAR2(255),
        v2  VARCHAR2(255),
        v3  VARCHAR2(255),
        v4  VARCHAR2(255),
        v5  VARCHAR2(255),
        v6  VARCHAR2(255),
        v7  VARCHAR2(255),
        v8  VARCHAR2(255),
        v9  VARCHAR2(255),
        v10 VARCHAR2(255),
        v11 VARCHAR2(255)
      );Regards,
    Jari
    Edited by: jarola on Nov 19, 2010 3:03 PM

  • How to save a .csv file to database server

    Hi every body,
    I need to upload a .csv file from the client machine and save it to a directory in a database sever.
    I could do the uploading part. Can anyone tell me how to save the file?
    Another option is save the file as a CLOB in a database column. But I'm not aware of doing that too.
    Please guide me.
    Thanks in advance.
    Surangi.

    See Steve Muench's Not Yet Documented Example #85 at http://radio.weblogs.com/0118231/stories/2004/09/23/notYetDocumentedAdfSampleApplications.html#85. While this is for 10.1.3, this is still relevant for 11g. Steve's example is for uploading to a BLOB - same thing for a CLOB. Once your data is in the database, you can use the DBMS_LOB package to write the file to a directory on the database server, if you like.
    Also the Developers Guide is your friend - Chapter 9.9 in the Fusion Web User Interface Developers Guide for Oracle ADF 11g, or 19.6 in the ADF Developers Guide for Forms/4GL Developers for JDeveloper 10.1.3.

  • .txt or CSV file to Database

    Hi-
    I have a text file generated by a Pulse Oximeter, What I want is, as the system recieves the file (in .txt of CSV) it automaticly is entered into a MySql Database or SQL Server and generates an SMS message. Thanks
    Regards
    Tayyab Hussain

    Web services imply using sychronous communication. However, the use case you describe implies that asynchronous, so-called fire-and-forget, communication is better suited to your needs.
    For example, with sychronous communication, the system is unaware of the exact moment a TXT or CSV file will come in. Also, when the system is processing a file, all other processing waits until the system finishes. This may cause synchronicity problems if multiple files come into the system in quick succession.
    ColdFusion has an asynchronous solution that suits every requirement of your use case. The following methods will enable you to receive the file, to automatically enter it into the database and to generate an SMS message. Use ColdFusion's DirectoryWatcher gateway to monitor the directory in which the TXT or CSV files are dropped, and ColdFusion's SMS event gateway to send SMS messages.
    Whenever a third party drops a file into the directory, an event is triggered, setting the DirectoryWatcher into action. Implement a query in the onAdd method of the DirectoryWatcher's listener CFC to store the file in the database.  Following the query, use the sendGatewayMessage method to send the SMS message.

  • Data Migration from CSV file to Database Table.

    Hi,
    I have checked few answered threads on Data Migration Issues but didn't find the solution yet.
    I am reading data from an CSV file to internal table but the complete row is coming under one field of the internal table.
    How i can get values in different fields of the internal table from the CSV file ?
    Thanks & Regards.
    Raman Khurana.

    Hi,
    If you are using GUI_UPLOAD, you might have missed to make has_field_separator  as 'X'.
      EXPORTING
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
       filename                      = 'C:\File.csv'
       filetype                      = 'ASC'
       has_field_separator           = ' X'  "<= Set this as 'X'.
      TABLES
        data_tab                      = itab.
    Regards,
    Manoj Kumar P

  • How to read the CSV Files into Database Table

    Hi
    Friends i have a Table called tblstudent this has the following fields Student ID, StudentName ,Class,Father_Name, Mother_Name.
    Now i have a CSV File with 1500 records with all These Fields. Now in my Program there is a need for me to read all these Records into this Table tblstudent.
    Note: I have got already 2000 records in the Table tblstudent now i would like to read all these CSV File records into the Table tblstudent.
    Please give me some examples to do this
    Thank your for your service
    Cheers
    Jofin

    1) Read the CSV file line by line using BufferedReader.
    2) Convert each line (record) to a List and add it to a parent List. If you know the columns before, you might use a List of DTO's.
    3) Finally save the two-dimensional List or the List of DTO's into the datatable using plain JDBC or any kind of ORM (Hibernate and so on).
    This article contains some useful code snippets to parse a CSV: http://balusc.xs4all.nl/srv/dev-jep-csv.html

  • How to regularly load data from .csv file to database (using apex)

    Hi,
    i am using apex3 , I need to load data from a csv file to apex . I need to perform this automatically through code at regular time interval of 5-10 seconds.
    Is it possible .If yes how ?. Please reply as early as possible. This will decide whether to use apex or not for this application.
    this is question for Application Express. Dont know why in forum for BPEL
    Edited by: TEJU on Oct 24, 2008 2:57 PM

    Hello,
    You really need to load the data every 5-10 seconds? Presumably it's read only?
    I would look at using an Oracle external table instead, that way you just drop your CSV in a location the DB can read it and then you build a table that essentially references the underlying CSV (that way when you query the table you view the data in the CSV file).
    Take a look at this link for a quick example on usage -
    http://www.oracle-base.com/articles/9i/SQLNewFeatures9i.php#ExternalTables
    Hope this helps,
    John.
    Blog: http://jes.blogs.shellprompt.net
    Work: http://www.apex-evangelists.com
    Author of Pro Application Express: http://tinyurl.com/3gu7cd
    REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone!

  • Csv file to database tables and also foreginkey related columns directly

    i have created dimensions tables in ssis  and i need to load  the data into that tables from my given csv files. iand i have foriegien key columns of fact table for this also data need to load

    definitely we have primary key relations..  the tables contain primary keys and forien keys  i have created tables nearly 20 tables  in sql server some of them consist of dimensions and facts.. so i have an csv files of data. so that i need
    to load data in that tables by using ssis package
    i have an idea taking one data flow task in control flow task for  each and every single table i am taking one oldb destination. for each and every one i need source as csv file. by connecting this both we can load data
    but i need to load data into 20 tables by taking on dataflow task..how it is possible any solution and any different ways to load data from csv files to ssispacke tables

  • Upload csv file to server database directory through Apex interface

    Hi All,
    I have created a file browse item in Apex Page. through which user should be able to upload the csv file to database directory located in server.
    I have created one directory object in my schema say NAN_DIR where mentioned the directory.
    Need urgent solution......
    Thanks in Advance
    Danalaxmi

    Hi Danalaxmi,
    There is an example in this thread:
    Re: Store \ Retrieve files from file system
    Regards,
    Benz

  • How do i import my local csv files into HANA database as temporary tables  using java program?

    I want to import my local csv file into database for further apply Join with other tables programmatic in JAVA

    Hi Vivek,
    Please go through the following blogs and video to resolve your issue.
    Loading large CSV files to SAP HANA
    HANA Academy - Importing Data using CTL Method - YouTube
    Hope it helps.
    Regards
    Kumar

  • Problem in uploading xls/csv file with Email address through oracle forms

    Dear all,
    I've created an interface to upload data from xls
    and csv files to database tables.
    I'm sucessed in this. Now i'm facing an issue.
    If the xls/csv file having Email address,the
    upload activity is not working..junk characters is
    getting stored.
    I came to know that, xls .csv file having email
    address with hiperlink. so this may cause the
    issue (just guessing)..
    we can't restrict users to upload email without
    hiperlink.. so what is the alternative to do
    this..
    Email address
    [email protected]
    [email protected]
    [email protected]
    etc...

    Can you give some more information:
    What versions of Forms, database, Java, browser are you using?
    How are you uploading data? Please show us your code.
    What do you mean by "email with a hyperlink"?

  • Jdvc driver for csv files

    do you know some free driver for using csv files as databases in java?

    I've tried this one and it seems to work. Its read-only though.
    http://csvjdbc.sourceforge.net/
    Col

  • How can I make an easy *.CSV file to load into database table

    Hi All,
    I have a huge excel sheet having columns item#, description and qty. The description column sometimes maybe one word name, two word name separated with space or may be , spearated name. I want to write and PL/SQl code which will read this file and load it into database table. Now the *.CSV file is either comma delimited or tab text delmited which both do not solve my issue. Is there any better solution with anyone which can prevent the manual editing to the *.CSV file and I can easily load it to table.
    Your help is appreciated,
    Thanks
    Zahir

    SQL*Loader is probably the fastest method, but since you specifically asked for a PL/SQL method:
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:464420312302

Maybe you are looking for

  • Load to psa is in yellow status only in quality n production system

    Hi All, We have created a generic FM which wil take date parameter as input and fetch records for that specific month. This FM works perfectly fine in dev server, but when i run the same in quality and production the load status is still in yellow st

  • Hard Drive and Startup Failure Code(Model: G61-429WM) Notebook

    Windows won't start because it is missing a .DLL file.  I ran the system diagnostic tests( Hard Drive and Startup) they both gave me the same failure code(UOC7HA-52H74A-XD0021-60X603).  When I turn the computer on, it tells me to insert the system di

  • Word 2013 Saving You Tube Videos

    Hello Community I have a question.  I have saved some youtube files onto my word doc. using 2013 office.  Does the actual youtube file get saved or just a web address to open up a file.  So...you are typing on your word doc.  you go to insert then on

  • Describe input xml

    Hi, I have created few doc style web services, with a very complex xml input and output. (1200 lines of xsd) Input and out put are xml as java.lang.String. What would be the best practice to represent this in the WSDL? Just a reference to the xsd fil

  • CS4 Timeline problems

    Hi all New to the forum and flash but have managed to create a short animated movie - unfortunatly the duration of the movie is made as 10 fps and last for 29 seconds (290 frames in total) but when I test the movie it plays to 36 seconds. Any body kn