cancel
Showing results for 
Search instead for 
Did you mean: 

How to create new sample application using webdynpro

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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)

Former Member
0 Kudos

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

Answers (0)