on 06-13-2005 8:58 AM
Hi,
Am new to WebDynpro.In this i want to create a new sample application.could you please give me the steps to do that.In webdynpro want to get the values from the the oracle database.. need code for this..
Murugan a
Hi
in WebDynPro u can create a Project and write the same piece of code in wdDoInit of the View Controller and Execute the same.
But u need to configure the data Source Name in the Visual Admin of ur WAS server.
initialContext ctx = new InitialContext();
DataSource ds = (DataSource) context.lookup("java:comp/env/jdbc/My Data Source")
Connection con = ds.getConnection();
String query = "select * from VEHICLE";
Statement stmt = conn.createStatement();
try {
ResultSet rs = stmt.executeQuery(query);
try {
System.out.println("vehicle list (name, price,"
+ "currency)");
while ( rs.next() ) {
System.out.println(rs.getString("NAME") + " " +
rs.getInt("PRICE") + " " +
rs.getString("CURRENCY"));
}
} finally {
rs.close();
} finally {
stmt.close();
}
Regards
Krishna kanth
Message was edited by: Armin Reichert
(Use code-tag)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hello,
u can connect to oracle database using the apis. u need to import classes123.zip file which contains DriverClasses.
write this code to connect to the data base:
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection(
"jdbc:oracle:thin:@<ip address>:<port>:DataSource",
"username",
"password");
after getting the Connection class object create the Statement and ResultSet.
regards,
Piyush
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.