cancel
Showing results for 
Search instead for 
Did you mean: 

How i use oracle's tables directly with dynpro application ?

Former Member
0 Kudos

Hi,

I need simple example of oracle based dynpro application.I want to make simple application in which i want to show some oracle tables . So please provide code for that . If possilble please provide answer with detail information.

Regards,

Gurprit Bhatia

Edited by: GURPRIT BHATIA on Aug 4, 2008 8:44 AM

Accepted Solutions (0)

Answers (1)

Answers (1)

PradeepBondla
Active Contributor
0 Kudos

Hi,

you can use EJB's to connect to database ( the recommonded way of doing following MVC), whrere you database connections and retreivals will be done in EJB which you will use in WD java applications.

or else you can directly write the connection code in you component controller..... check in SDN you will find many threads on this...

for example code to connect to oracle is...

Connection connTest =null;
Statement statement=null;
ResultSet rSet=null;
String driverName = "oracle.jdbc.driver.OracleDriver";
 
Class.forName(driverName);
 
// Create a connection to the database
 
String serverName = "servername";
 
String portNumber = "xxxx";
 
String sid = "XXX";
 
String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
 
String username = "xxxuser";
 
String password = "xxxx";
 
connTest = DriverManager.getConnection(url, username, password);
statement=connTest.createStatement();
rSet=statement.executeQuery("select * from your table");
while(rSet.next())
{
print(rSet.getString("colomn name"));
}

PradeeP