cancel
Showing results for 
Search instead for 
Did you mean: 

update oracle database

Former Member
0 Kudos

Hi all,

I tried to search sample tutorial with oracle database, can any one share the link if you have got.

I am trying to build application with user input and storing in the oracle database.

thanks

Accepted Solutions (1)

Accepted Solutions (1)

junwu
Active Contributor
0 Kudos

just some jdbc programming.

what kind of code you want?

you just get the value from the context, and use jdbc to persist the data, i don't see any difficulty there.

Former Member
0 Kudos

Hi John,

The JDBC connection is already established. I was not able to understand how the input field to be update on the database, say user enters data ,there are 10 input field, which we have to store in context node. and then with insert statement we have to update database , how do we insert the stored context value to database ?

Class.forName("oracle.jdbc.driver.OracleDriver");

DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());

conn = DriverManager.getConnection("jdbc:oracle:thin:@IP:PORT:PORTAL","XYZ","PWD");

stmt = conn.createStatement();

rs = stmt.executeQuery("select * from employee");

String strname = null;

while (rs.next()){

wdComponentAPI.getMessageManager().reportException(rs.getString("ID"),false);

}

ps = conn.prepareStatement("INSERT INTO employee VALUES (value 1,value 2)");

Thank for quick reply

junwu
Active Contributor
0 Kudos

you haven't done any jdbc code?

? means you can put the context value.

please google some basic jdbc tutorial to help you understand the code

try {
       con = ds.getConnection("webLogin", "webPassword");
       pstmt = con.prepareStatement("UPDATE COFFEES " +
         "SET TOTAL = TOTAL + ? WHERE COF_NAME = ?");
       pstmt.setInt(1, incr);
       pstmt.setString(2, cofName);
       pstmt.executeUpdate();
       stmt.close();

     } finally {
       if (con != null) con.close();
     }

Answers (1)

Answers (1)

chinna_babu2
Active Participant
0 Kudos

Hi Kiran,

Create EJB Module and use it as Model in your project. You need to have the drivers for oracle installed on your server and datasource created in J2EE engine.

See the below link help you for this approach.

[]

Regards,