Forum Stats

  • 3,851,337 Users
  • 2,263,965 Discussions
  • 7,904,684 Comments

Discussions

Adding dependent libraries for java embedding in BPEL

Powerlad
Powerlad Member Posts: 93

Hi All,

I am trying to insert data to database from java embedding in bpel process. Find below the code being used in java embedding

try {   
      
String driver = "oracle.jdbc.driver.OracleDriver";   
  String url = "jdbc:oracle:thin:@x.x.x.92:1523:dev3";   
  String username = "scott";   
String password = "xxxx";   
String var1="abc"; 
String var2="software"; 
int i=1;
    Class.forName(driver);   
    Connection conn = DriverManager.getConnection(url, username, password);
    PreparedStatement pstmt = null;
    String query = "insert into EMP(EMPNO,JOB,MGR) values(?, ?, ?)";   
   
      pstmt = conn.prepareStatement(query); // create a statement   
      pstmt.setInt(1, i); // set input parameter 1   
      pstmt.setString(2, var1); // set input parameter 2   
      pstmt.setString(3, var2); // set input parameter 3   
      pstmt.executeUpdate(); // execute insert statement   
    } catch (Exception e) {   
      System.out.println("error..."+e.printStackTrace());   
    }

I have kept the ojdbc5 jar in SCA-INF\lib and added an import statement in BPEL source code using the below tag to refer the objects used in the code.

<bpelx:exec import="java.sql.*"/>

While comping I am ending p with error. Please help me out if there is any problem in the steps mentioned above.

Thanks.

Tagged:

Answers

  • Anshul
    Anshul Member Posts: 386

    I would like to give you one suggestion, just create a separate java file for db connection and db operation in the same project. And call these java files in java embedded activity. By doing this you can avoid the errors as it is sometimes very difficult to trace the error while using embedded activity.

    Regards,

    Anshul

This discussion has been closed.