IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

CAF -- dynamic query against Database

  • 1.  CAF -- dynamic query against Database

    Posted Mon November 24, 2008 12:04 AM

    Hi,

    I am new on CAF.

    Instead of using database connector, which is no much flexible for the query statement. I want to build a dynamic query against Oracle database, and display result in a table on view.

    I would like to write a following code in Designer, and binding the result with table in view.

    try{
    Class.forName(“oracle.jdbc.driver.OracleDriver”);
    String url=“jdbc:oracle:thin:@localhost:1521:OracleDB”;
    Connection connection = DriverManager.getConnection(url, “user”, password");
    Statement stmt=connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_READ_ONLY);
    rs=stmt.executeQuery(“SELECT * FROM tbl_Employee”);
    }
    catch(SQLException e){}
    catch(ClassNotFoundException e){}
    return rs;
    }

    Is it a correct approach?

    Thanks,

    Shuren


    #webMethods-BPMS
    #MWS-CAF-Task-Engine
    #webMethods


  • 2.  RE: CAF -- dynamic query against Database

    Posted Tue November 25, 2008 12:05 AM

    I don’t consider hard coding connection parameters into the code as “more flexible”. What are you really trying to accomplish that can’t be done with the db connector?

    Mark


    #MWS-CAF-Task-Engine
    #webMethods
    #webMethods-BPMS


  • 3.  RE: CAF -- dynamic query against Database

    Posted Tue November 25, 2008 12:52 AM

    Hi Mark,

    Thanks your reply.

    I just want to write a simple query like “select * from Employee where EmployeeID = ?”

    and binding the textbox with input parameter.

    Q1:
    If textbox is null, query should return all the results. However, if I use above query, the result will be null.

    Q2:
    How can I add a html control, like a delete button, which can delete the corresponding row. DB connector generates the table, and it’s hard to modify.

    Thanks,

    Shuren


    #webMethods
    #MWS-CAF-Task-Engine
    #webMethods-BPMS