on 12-13-2005 11:18 AM
Hey people!
I want to access a simple sql query on an oracle database and write the output in web dynpro.. Do i have to make an ejb for that? an how do i do that? or is it an easier way?
Hi Kristoffer,
It's not necessary to have an ejb. It's possible to write your sql query directly in web dynpro code.
But, of course, in more complicated cases it's better to separate your UI and business logic.
Andrei Smolkin
EPAM Systems
<a href="http://www.netweaverteam.com/">http://www.netweaverteam.com/</a>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Kristoffer,
You can take any simple example of using web dynpro and replace test data with data from your sql query.
For example, you can get it from Net Weaver IDE "...\eclipse\examples\WebDynpro_Table.zip" and change method "createBasket( )". In this method you can directly connect to the DB and apply your data to the web dynpro node instead test data defined in this application.
Andrei Smolkin
EPAM Systems
<a href="http://www.netweaverteam.com/">http://www.netweaverteam.com/</a>
I have managed to connect to my database now..
if someone else have the same problem then here is what i did:
1) make a datasource in VA
2) set up a connection in your dynpro code:
InitialContext ctx = new InitialContext();
javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup("jdbc/YourAlias");
java.sql.Connection con = ds.getConnection();
java.sql.Statement stmt = con.createStatement();
rs = stmt.executeQuery("SELECT * from table");
3) run true your recordset and get the values
eg. rs.getString(1)
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.