Can webmethods insert from stringlist to oracle table with j

Hii all,

Can anyone help me how insert stringlist from IS to oracle table with jdbc.

Rg,
-Widodo-

Widodo,

Assuming you want each string to be stored in a separate database record, you could do this:

  • Convert the string list to a document list with field names matching the DB column names. Assign key field values as required.
  • Call a BatchInsertSQL service to populate the DB in a single call.

HTH,
Michael

Hi Widodo,

You could also try that:

create a java-flow with input variable “strlist” as string list.
Then add (not tested) source code below. It’s not a nice
peace of code, but it might give you an idea.

You’ve of course to check for the right JDBC driver and place
it in the lib/jars folder of the IS or your package.

Good luck

André

 private static JDBCConnection dbConnection = null;
 IDataCursor cursor = pipeline.getCursor();
 cursor.first("strlist"); 
 String list[]  = (String[])Cursor.getValue();

 try 
 { 
   dbConnection = new JDBCConnection ("db", "user", "passwd", "driver"); 

 } catch (DBConnectionException e) 
 { 
   // do something 
 }


 try
 {
     query =  "INSERT INTO TABLE"
                      +"(FIELD1,"
                      +" FIELD2)"
                + "VALUES ('"+list[0]+"','"
                                     +list[1]+"'"')";

   Values result = dbConnection.execSQL (query);

   dbConnection.commit();
 } catch (DBConnectionException e) 
 { 
   // do something 
 }

Hi all,

Thx for your solution i will try.

Best Regard,
-Widodo