I create custom connector for write data into database .
now i create one from :‘emp_details’
how can i get this form’s data into connector . for write this form data into database
Let take Clear example :
one from : emp_detail
fields on that form : name , address
connector i created code is as follow , so how can i pass forms field into this preparedstatement’s query
/**
*
*/
package org.mycompany.connector;
import org.bonitasoft.engine.connector.ConnectorException;
import java.sql.*;
public class OracleWriteImpl extends AbstractOracleWriteImpl {
// JDBC driver name and database URL
static final String JDBC_DRIVER = "oracle.jdbc.driver.OracleDriver";
final String DB_URL ="jdbc:oracle:thin:@200.200.1.224:1583:DNLCLONE";
private Connection conn;
private PreparedStatement pstmt;
@Override
protected void executeBusinessLogic() throws ConnectorException{
try {
String sql = "INSERT INTO XX_HOTEL(NAME,ADDRESS)VALUES (?,?)";
pstmt = conn.prepareStatement(sql);
* pstmt.setString(1, ??????????); // how to get form's input (field : name )
pstmt.setString(2, ??????????); // how to get form's input (field : address )*
pstmt.executeUpdate();
} catch (SQLException e) {
throw new ConnectorException(e);
}
}
@Override
public void connect() throws ConnectorException{
try {
Class.forName(JDBC_DRIVER);
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
throw new ConnectorException(e);
}
try {
conn = DriverManager.getConnection(DB_URL,getUser(),getPass());
} catch (SQLException e) {
// TODO Auto-generated catch block
throw new ConnectorException(e);
}
}
@Override
public void disconnect() throws ConnectorException{
try {
pstmt.close();
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
throw new ConnectorException(e);
}
}
}