CSV to JDBC

I have a CSV file with multiply records I am trying to insert into an Oracle database.  I have been able to sucessfully insert only the first record from the file into the table.  Does anyone have any idea on why only the first record is getting inserted?
Thanks
Skip Ford

This is the structure for the outbound CSV file.
DT_OUTPLAIN          complex type
      ROW              element         xsd:sting              0...unbounded
          name          element         xsd:sting              1
          date            element        xsd:sting               1
          car              element        xsd:sting               1
This is the inbound to JDBC
DT_INPLAIN_JDBC_REC    complex type
    STATEMENTNAME        element                                 1
        SKIP_TEST               element                                 1
              action                  atribute            xsd:sting        optional
              TABLE                 element           xsd:sting        1
              access                 element                                1
                   data1               element          xsd:sting         1
                   data2               element          xsd:sting         1
                   data3               element          xsd:sting         1
So the goal is to take the multiply records from the CSV file and insert them into the oracle database.
Thanks
Skip Ford

Similar Messages

  • Need help with CSV to JDBC scenario

    Hi experts,
    We have a CSV file with data which has to be inserted into a SQL server database.
    The sender data type is:
    snd_dt  complex type
    row element 0..unbounded
    name element  xsd:string 0..1
    date element xsd:string 0...1
    ratio element xsd:string 0...1
    The receiver data type is :
    rcv_dt complex type
    STATEMENT element
    ROW element
    action Attribute
    TABLE element
    access element  0...unbounded
    name element xsd:string 0...1
    date element xsd:string 0...1
    ratio element xsd:string 0...1
    Now I did the mapping and also did the steps in ID.
    In the database, for the table in the SQL server, the datatype for name is "char(3)", for date is "date" and for ratio is "decimal(9,2)"
    When I run the scenario, this gives me an error saying:
    MP: Exception caught with cause com.sap.aii.af.ra.ms.api.RecoverableException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'NAME' (structure 'STATEMENT'): com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near ')'.
    I am doing a direct "INSERT" action into the table.
    How do I resolve this error?
    ANy help mwould be greatly appreciated.

    This is the exact error I am running into.
    SQL log statement:
    INSERT INTO  NAME() VALUES ()
    Error:
    Unable to execute statement for table or stored procedure. 'NAME' (Structure 'STATEMENT') due to com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near ')'.
    When I put this SQL statement in SQL server, there are field names inside the parantheses of VALUES. Is this the reason why there is error??
    Also, the receiver pay load looks like this:
      <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:MT_NAME_TABLE xmlns:ns0="http://jdbc2jdbc">
    - <STATEMENT>
    - <ROW action="INSERT">
      <TABLE>NAME</TABLE>
      <access />
      <access />
      <access />
    </ROW>
      </STATEMENT>
      </ns0:MT_NAME_TABLE>
    Regards.

  • CSV and JDBC

    Is there a jdbc driver for a csv file. I want to implement a database on a client machine without them having to install a database back end.
    (actually the csv is extracted from a vision database which i've never once heard of, does anyone know if vision is a commercial database, i have a feling its a companies proprietry database!)
    Pete

    The post you are responding to is 2.5 YEARS OLD!
    And he's been coding all this time.
    Way past my bedtime,
    Dylan

  • File (csv) to JDBC

    I am trying to read in a CSV file with the file adapter.  I have used file content conversion, and I am getting the following error.  Any help would be greatly appreciated.
    Thanks
    Skip Ford
    <b><b>Conversion initialization failed: java.lang.Exception: java.lang.Exception: java.lang.Exception: Error(s) in XML conversion parameters found: Format error in 'xml.recordset' argument: incomplete structure (name,number) pair</b></b>

    The file looks like below...
    John,1/2/2007,Ford
    Ralph,2/4/2005,Chevy
    Content Conversion Parameters
    Document Name : output.txt
    Docuemnt Namespace : http://companyname.com/sapxi/edhr/vendordata
    Recordset Structure : ROW
    Recordset Sequrence : Ascending
    Ke Field Type : String (Case-sensitive)
    ROW.fieldSeparator : ,
    ROW.endSeparator : 'nl'
    ROW.processFieldNames : fromConfiguration
    ROW.FieldNames : name,date,car
    Other Note: I am doing mapping also...

  • Connecting to CSV/Excel

    Good Morning,
    I'm working with a back-up admin on setting up the CSV/Excel JDBC drivers to enable me to connect VC models to CSV/Excel data.
    Can anyone provide a step-by-step (or more detailed description) for the setup steps at: <a href="https://www.sdn.sap.com/irj/sdn/wiki?path=/display/vc/jdbcConnectionSetup&.">SDN VC - JDBC Connection Setup</a>
    After navigating to the described service, the admin is not sure of the next step.
    Are the above steps at SDN for NW04s?
    Thanks

    There is a whole section in the WIKI with links to setup for different BI connectors:
    https://wiki.sdn.sap.com/wiki/display/VC/Setup+connections
    And yes, those are all valid for NW04s.

  • Loading csv files from JDBC

    What is the best way to load a csv file using JDBC link? Right now I basically read a line and insert it, batching it doesn't seem to speed it up either.
    Thanks
    Brian Timothy
    null

    Hai !
    I think i can help u in this as i have done almost the same thing...
    In Oracle for importing the data from other databases there is one bulk insert command ie SQLLDR...This commands takes parameters as a Control File(*.ctl) and data file ie(*.csv) ......You can get more help on it on the site if you search for SQL Loader....
    But i think it cann't be executed from StoredProcedure's so what i am doing is running this command from my java application using Runtime.exec("SQLLDR...................") .
    I think this will help you ...You are always welcome for any more clarifications....
    Regards
    Brijesh Kumar
    SSI-Technologies

  • JDBC to CSV file Scenario

    Hi ALL,
    I have a scenario where the integration results in the jdbc to csv file format.
    Here the data is following from non-sap system (Ccure system with progress database) to SAP (ECC).
    we have pull data from non-sap on daily bases that is once in a day (say morning @ 7 am), create a file in csv format and place this file in ECC.
    the issue over is, how to make it run on daily basis and retrieve only particular information from the progress database.
    please put on your thoughts on this issue.
    Thanks,
    Lalitkumar.

    Hi,
    how to make it run on daily basis and retrieve only particular information from the progress database.
    1.how to make it run on daily basis
    Through Available Time Planing in RWB--> CC Monitoring.
    Here u have the option for choosing the the time at which u want to run the CC
    2.retrieve only particular information from the progress database
    There are lot of techniques to do this.
    a. when ever u retrieve the data from Database and if it is successful them mark the record as read.
    For this u can have extra column in table and set the flag as read/unread or 0/1.
    when u select in next query, select based on this field also..
    Babu

  • JDBC wrapper for CSV files?

    I wrote my own method to read in CSV files into a table structure (String[][]). For big CSV files, I added several functionalities to ignore specific data lines that have specific values. All this looks quite similar to a database table that I do a select * for and reduce the resulting rows via specific WHERE clause criterias. So I wonder if there's already such a JDBC wrapper around CSV files?

    Yes. I believe the JDBC-ODBC bridge can use an Excel URL to read in a CSV. Though don't quote me on that one.
    However, why not simply use your RDBMS data-import utility? You can invoke it from a scheduler or from Runtime.exec(). It should perform MUCH better than middleware for a huge CSV file. If manipulation needs to occur for the data, write it first to a temp table, then manipulate it.
    - Saish

  • JDBC vs excell csv file

    Hi All,
    Could JDBC API read off values from an excell csv file? Such that they could be transferred easily to JTables? Thanx again ^^

    you could configure the "Microsoft Text Driver" (which is for CSV and text files), from 32-bit ODBC option of control panel in Windows Systems (if u r using windows).
    Then u can query using normal JDBC SQL syntax,
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:myDsn");
    Statement stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery("select * from myCsvFile.csv");
    Priya.

  • Where can I get JDBC driver for plain text (csv)

    Is there any in installation package? Or I should buy commercial drivers, e.g. httx?
    Or maybe there are any other ways to load data from URL(csv) to BW?

    Hello,
    try the following:
    http://sourceforge.net/projects/csvjdbc/
    or this one:
    https://xlsql.dev.java.net/
    Istvan

  • Why ResultSet getDate() method returns null when querying .csv file?

    Here is the full code:
    import java.sql.*;
    import java.sql.Types;
    import java.sql.Date;
    import myjava.support.CachedRowSetMaker;
    import javax.sql.rowset.CachedRowSet;
    import java.io.IOException;
    import java.text.SimpleDateFormat;
    import java.util.Calendar;
    class jdbc2{
    final private String s1="SELECT top 10 [DATE], [ADJ CLOSE] FROM [vwo-1.csv]";
    private ResultSet result=null;
    private Connection conn=null;
    public static void main(String[] args) throws SQLException{
    jdbc2 db=new jdbc2();
    try {
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              db.conn = DriverManager.getConnection("jdbc:odbc:STOCK_DATA");
              PreparedStatement sql=db.conn.prepareStatement(db.s1);
              db.result=sql.executeQuery();
    // check column names and types using the ResultSetMetaData object.
              ResultSetMetaData metaData = db.result.getMetaData();
         System.out.println("Table Name : " + metaData.getTableName(2));
         System.out.println("Field\t\tDataType");
         for (int i = 0; i < metaData.getColumnCount(); i++) {
         System.out.print(metaData.getColumnName(i + 1) + "\t");
         System.out.println(metaData.getColumnTypeName(i+1));
         System.out.print(metaData.getColumnName(1) + "\t"+metaData.getColumnName(2)+"\n");
              while (db.result.next()){
                   System.out.print(db.result.getDate("DATE", Calendar.getInstance()));
                   System.out.format("\t%,.2f\n", db.result.getFloat("Adj Close"));
    catch (Exception e) {
    System.out.println("Error: " + e.getMessage());
         finally {
              db.result.close();
              db.conn.close();
    Everything works well, until getting to the block
              while (db.result.next()){
                   System.out.print(db.result.getDate("DATE", Calendar.getInstance()));
                   System.out.format("\t%,.2f\n", db.result.getFloat("Adj Close"));
    The getDate("DATE", Calendar.getInstance())); always returns null, instead of the date value in the vwo-1.csv.
    Even though I change it to
    java.sql.Date d=db.result.getDate("DATE") and convert to String using .toString(), I still gets nulls. The dollar amount in "Adj Close" field is fine, no problem.
    The .csv fils is downloaded from YahooFinace.
    Can anyone review the code and shed some light as to what I did wrong?
    Thanks alot.

    CREATE TABLE `login` (
    `username` varchar(40) DEFAULT NULL,
    `password` varchar(40) DEFAULT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    CREATE TABLE `amount` (
    `amountid` int(11) NOT NULL,
    `receiptid` int(11) DEFAULT NULL,
    `loanid` int(11) DEFAULT NULL,
    `amount` bigint(11) DEFAULT NULL,
    `latefee` int(11) DEFAULT NULL,
    `paymentid` int(11) DEFAULT NULL,
    `pid` int(11) DEFAULT NULL,
    PRIMARY KEY (`amountid`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    CREATE TABLE `applicationfee` (
    `applicationfeeid` int(11) DEFAULT NULL,
    `applicationamount` int(11) DEFAULT NULL,
    `applicationfee` int(11) DEFAULT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    CREATE TABLE `category` (
    `categoryid` int(11) DEFAULT NULL,
    `categoryname` varchar(40) DEFAULT NULL,
    `categorydescription` varchar(500) DEFAULT NULL,
    `cattype` int(11) DEFAULT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    CREATE TABLE `commission` (
    `commissionid` int(11) DEFAULT NULL,
    `bussiness` int(11) DEFAULT NULL,
    `commission` int(11) DEFAULT NULL,
    `pid` int(11) DEFAULT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    CREATE TABLE `customer` (
    `cacno` int(11) NOT NULL DEFAULT '0',
    `name` varchar(40) DEFAULT NULL,
    `age` int(11) DEFAULT NULL,
    `cphone` varchar(40) DEFAULT NULL,
    `cmobile` varchar(40) DEFAULT NULL,
    `caddress` varchar(500) DEFAULT NULL,
    `cstatus` varchar(20) DEFAULT NULL,
    `cphoto` longblob,
    `pid` int(11) DEFAULT NULL,
    PRIMARY KEY (`cacno`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    CREATE TABLE `daybook` (
    `closingbal` varchar(40) DEFAULT NULL,
    `date` date DEFAULT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    CREATE TABLE `extraincome` (
    `categoryid` int(11) NOT NULL,
    `receiptid` int(11) DEFAULT NULL,
    `date` date DEFAULT NULL,
    `amountid` int(11) DEFAULT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    CREATE TABLE `employee` (
    `empno` int(11) DEFAULT NULL,
    `empname` varchar(40) DEFAULT NULL,
    `age` int(11) DEFAULT NULL,
    `sal` int(11) DEFAULT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    CREATE TABLE `image` (
    `id` int(11) DEFAULT NULL,
    `image` blob
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    CREATE TABLE `loan` (
    `loanid` int(11) NOT NULL DEFAULT '0',
    `loanamt` varchar(40) DEFAULT NULL,
    `payableamount` double DEFAULT NULL,
    `installment` int(11) DEFAULT NULL,
    `payableinstallments` int(11) DEFAULT NULL,
    `monthlyinstallment` varchar(20) DEFAULT NULL,
    `surityname` varchar(20) DEFAULT NULL,
    `applicationfeeid` int(11) DEFAULT NULL,
    `interestrate` float DEFAULT NULL,
    `issuedate` date DEFAULT NULL,
    `duedate` date DEFAULT NULL,
    `nextduedate` date DEFAULT NULL,
    `cacno` int(11) DEFAULT NULL,
    `cname` varchar(20) DEFAULT NULL,
    `pid` int(11) DEFAULT NULL,
    `interestamt` double DEFAULT NULL,
    `pendingamt` float DEFAULT NULL,
    PRIMARY KEY (`loanid`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    CREATE TABLE `md` (
    `mdid` int(11) NOT NULL DEFAULT '0',
    `mdname` varchar(40) DEFAULT NULL,
    `mdphoto` varchar(100) DEFAULT NULL,
    `mdphone` varchar(40) DEFAULT NULL,
    `mdmobile` varchar(40) DEFAULT NULL,
    `mdaddress` varchar(500) DEFAULT NULL,
    PRIMARY KEY (`mdid`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    CREATE TABLE `partner` (
    `pid` int(11) NOT NULL DEFAULT '0',
    `pname` varchar(40) DEFAULT NULL,
    `paddress` varchar(500) DEFAULT NULL,
    `pphoto` varchar(100) DEFAULT NULL,
    `pphone` varchar(40) DEFAULT NULL,
    `pmobile` varchar(40) DEFAULT NULL,
    `pstatus` varchar(20) DEFAULT NULL,
    `mdid` int(11) DEFAULT NULL,
    `mdname` varchar(40) DEFAULT NULL,
    `date` date DEFAULT NULL,
    `nextpaydate` date DEFAULT NULL,
    PRIMARY KEY (`pid`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    CREATE TABLE `partnerinvested` (
    `pid` int(11) DEFAULT NULL,
    `pname` varchar(20) DEFAULT NULL,
    `receiptid` int(11) DEFAULT NULL,
    `date` date DEFAULT NULL,
    `amountinvested` int(11) DEFAULT NULL,
    `latefee` int(11) DEFAULT NULL,
    `amountid` int(11) DEFAULT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    CREATE TABLE `payments` (
    `paymentid` int(11) NOT NULL,
    `categoryid` int(11) DEFAULT NULL,
    `particulars` varchar(100) DEFAULT NULL,
    `amountid` int(11) DEFAULT NULL,
    `paymentdate` date DEFAULT NULL,
    PRIMARY KEY (`paymentid`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    CREATE TABLE `receipts` (
    `receiptid` int(11) DEFAULT NULL,
    `paiddate` date DEFAULT NULL,
    `amountid` int(11) DEFAULT NULL,
    `loanid` int(11) DEFAULT NULL,
    `latefee` int(11) DEFAULT NULL,
    `installment` int(11) DEFAULT NULL,
    `cacno` int(11) DEFAULT NULL,
    `cname` varchar(40) DEFAULT NULL,
    `pid` int(11) DEFAULT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

  • Generating CSV file with column names and data from the MySQL with JAVA

    Hi all,
    Give small example on ...
    How can I add column names and data to a CSV from from MySQL.
    like
    example
    sequence_no, time_date, col_name, col_name
    123, 27-apr-2004, data, data
    234, 27-apr-2004, data, data
    Pls give small exeample on this.
    Thanks & Regards
    Rama Krishna

    Hello Rama Krishna,
    Check this code:
    Example below exports data from MySQL Select query to CSV file.
    testtable structure
    CREATE TABLE testtable
    (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    text varchar(45) NOT NULL,
    price integer not null);
    Application takes path of output file as an argument.
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    public class automateExport {
        public static void main(String[] args) {
            DBase db = new DBase();
            Connection conn = db.connect(
                    "jdbc:mysql://localhost:3306/test","root","caspian");
            if (args.length != 1) {
                System.out.println(
                        "Usage: java automateExport [outputfile path] ");
                return;
            db.exportData(conn,args[0]);
    class DBase {
        public DBase() {
        public Connection connect(String db_connect_str,
                String db_userid, String db_password) {
            Connection conn;
            try {
                Class.forName("com.mysql.jdbc.Driver").newInstance();
                conn = DriverManager.getConnection(db_connect_str,
                        db_userid, db_password);
            } catch(Exception e) {
                e.printStackTrace();
                conn = null;
            return conn;
        public void exportData(Connection conn,String filename) {
            Statement stmt;
            String query;
            try {
                stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                        ResultSet.CONCUR_UPDATABLE);
                //For comma separated file
                query = "SELECT id,text,price into OUTFILE  '"+filename+
                        "' FIELDS TERMINATED BY ',' FROM testtable t";
                stmt.executeQuery(query);
            } catch(Exception e) {
                e.printStackTrace();
                stmt = null;
    Greetings,
    Praveen Gudapati

  • How to read the TEXT TABLE (or) .CSV in HSQLDB Standalone using Java

    Hi, I like to use the text tables in our application. And like to use the HSQL Database Engine as Standalone. I created the text tables, those are stored in the disk as ".CSV" files. But i am unable to read that text table (.CSV) when i relogin and gave the CSV file path as URL along with "jdbc:hsqldb:file". So can anybody give me the tips how use the text tables.
    Regards,
    Vinay

    You need to make a URLConnection to the page you want, and get the input stream from that page.
    The contents of the input stream (use a reader to get them) will give you the raw HTML code. Use a parser to get the actual content. I dont know of a parser offhand, but you can search for one.

  • 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.

  • Problem in handling multiple source of Complex CSV files in ODI

    Hi,
    I have a requirement where I have multiple CSV files.
    In Details:
    when I have one CSV file I use the following syntax in JDBC URL in creation of Data Server under Complex file of Topology navigator.
    jdbc:snps:complexfile?f=C:\pqr\pqr.csv&d=C:\pqr\pqr.xsd&re=Root
    When there are multiple CSV files what would be the syntax as? will it be like
    jdbc:snps:complexfile?f=C:\pqr\*.csv&d=C:\pqr\pqr.xsd&re=Root (I am getting error as unexpected token * when I am using * and clicking on Test Connection Button).
    Please help..
    Thanks.

    Hi,
    first of all according to documentation use backslash
    http://docs.oracle.com/cd/E21764_01/integrate.1111/e12644/appendix_complex_driver.htm#CCHDJGHF
    in second place under my opinion you are not able to use mask to identify more file. A workaround is to use a variable to store the file name. BUT i've never used Complex Files, so i'm speculating about it.

Maybe you are looking for

  • My ratings have "disappeared"

    I made a second library for about 5000 photos (CR2) that I took on a trip, which lives on a networked hard drive.  I applied ratings and keywords to about half of the images; but since upgrading to Lion and Aperture 3.2, I cannot see any of the ratin

  • Why Oracle Names have been discontinued in Oracle 10g

    Hello, I wanted to know why Oracle Names is not supported in Oracle 10g? Desupporting Oracle Names in future releases on Oracle is a big decision, as most of the sites still use Oracle 8i for legacy applications, which does not support OID. Translati

  • The last photo taken does not show up in camera roll until I re-open the photos app. (new iphone 5s)

    When I take a photo then touch the photo thumbnail in lower left corner, the screen opens to the previous photo I took. If I touch "Camera Roll" I see all the photos except the most recent photo. In order to see the most recent photo in Camera Roll I

  • Premiere CC 2014 no playback

    HI, I'm working on a wedding film currently, and i've got a serious problem. Everything was just working fine and suddenly my blackback window didn't work anymore. When I hit the spacebar it didn't work and it went from the play button, so stop, to p

  • Safari says I'm not connected to Internet-Airport says I am w/good signal

    I've moved. I am using AT&T DSL as Internet Service Provider. My PC/Base station is running VIsta Home. The Base station router is LINKSYS Wireless-G Microsoft Broadband. It's all interfaced beautifully before with my iMac and MacBook Pro. Since the