on 10-22-2007 8:43 AM
Hi Experts
I need to insert values in a oracle database could u please give me the EJB code for it
hi
good
check this code,
// Insert1.java: Demonstrates how to INSERT data into an SQL
// database using Java JDBC.
//
// Copyright 1998 Developer's Daily (http://www.DevDaily.com). All rights reserved.
import java.sql.*;
class Insert1 {
public static void main (String[] args) {
try {
String url = "jdbc:msql://200.210.220.1:1114/Demo";
Connection conn = DriverManager.getConnection(url,"","");
Statement st = conn.createStatement();
st.executeUpdate("INSERT INTO Customers " +
"VALUES (1001, 'Simpson', 'Mr.', 'Springfield', 2001)");
st.executeUpdate("INSERT INTO Customers " +
"VALUES (1002, 'McBeal', 'Ms.', 'Boston', 2004)");
st.executeUpdate("INSERT INTO Customers " +
"VALUES (1003, 'Flinstone', 'Mr.', 'Bedrock', 2003)");
st.executeUpdate("INSERT INTO Customers " +
"VALUES (1004, 'Cramden', 'Mr.', 'New York', 2001)");
conn.close();
} catch (Exception e) {
System.err.println("Got an exception! ");
System.err.println(e.getMessage());
}
}
}
http://www.devdaily.com/java/edu/pj/jdbc/jdbc0002/
reward point if helpful.
thanks
mrutyun^
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.