Dynamic table creation in mule flow

Arijit Bose

in my requirement i am receiving data from file(excel) and inserting it into database. But the table name i am getting during processing of the file based on some business logic. I am supposed to check whether the table exists with the name, if exists then update it else create and insert data into it. Is this requirement possible to achieve without custom java code using the mule studio provided componets or endpoints? Thanks in advance.

user1820620

I don't think it's possible with standard components.

Saying you have 3 tables that can be mapped by three xls you could define three datamappers statically and call them upon certain logic on a choice component. It's pretty straightforward to check if a table exist with groovy/java, for example you can use:

java.sql.DatabaseMetaData dbm = con.getMetaData();
            rs = dbm.getTables(null, null, "TableName", null);
            if (rs.next()) {
                System.out.println("TableName found");
            }else{
                System.out.println("TableName NOT found");
} 

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related