Service Virtualization

  • 1.  How to read excel file and convert into database table?

    Posted Oct 12, 2017 06:21 AM

    I have created a database table using MYSQL with columns equal to the columns present in the excel file. I need to read the excel file and copy the values from excel file to the database table. Is there any direct option available in devtest to achieve this?



  • 2.  Re: How to read excel file and convert into database table?

    Broadcom Employee
    Posted Oct 12, 2017 08:35 AM

    Have you tried using the SQL Database Execution (JDBC) step?

     

    SQL Database Execution (JDBC) - DevTest Solutions - 10.1 - CA Technologies Documentation 



  • 3.  Re: How to read excel file and convert into database table?

    Posted Oct 12, 2017 09:37 AM

    Option 1

    1. Read dataset and use jdbc step to insert the data.

    2. Run it in loop.

     

    Option 2 (requires tdm jars that reads excel worksheet as table)

    1. read all rows using sql and write to table.



  • 4.  Re: How to read excel file and convert into database table?
    Best Answer

    Posted Oct 12, 2017 09:39 AM

    You can use Read rows from Excel dataset couples with SQL execution Step, in a loop until the sheet is exhausted and all rows inserted into table...see screens below

     

     

     



  • 5.  Re: How to read excel file and convert into database table?

    Posted Oct 13, 2017 04:42 AM

    Thanks for the swift response!

    This steps are working fine, but in the SQL Database Execution step I am not able to execute the INSERT statement.

    I am getting the following exception "java.sql.SQLException: Can not issue data manipulation statements with executeQuery()" 

    Do I need to add any additional jars to execute the INSERT statement?



  • 6.  Re: How to read excel file and convert into database table?

    Posted Oct 13, 2017 06:00 AM

    Uncheck the box- return result as recordset.