cancel
Showing results for 
Search instead for 
Did you mean: 

web Dynpro application connecting to oracle

Former Member
0 Kudos

Hi all,

i want to create a web Dynpro application which will fetch data from oracle database.

Can anyboby guide me with some documents.

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sarika,

For more information on this ,look at these loops.

Regards,

Karthick

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Thanks a lot.your answers were quite helpful to me.

Regards,

Sarika.

Former Member
0 Kudos

Hey sarika

Have you made it work yet? I had the same problem, and was using alot of my time trying to debug it. Then i came over a brilliant way to check if the datasource works. You can add your database connection in the Visual Administrator, and create an Alias. From webdynpro you just call on that alias when you want that datasource. Using this method allows you to type queries direct with telnetting j2ee server.

If you want, I can explain how? If you have not figure it out yet?

Former Member
0 Kudos

Hi kristoffer,

I got your idea but i am not getting how to access datasource alias in web dynpro & fire queries.

Can u explain it in detail.Its sounds interesting & right now I want to check connectivity of database with my application.

Former Member
0 Kudos

1) Open SAMMMC

2) Open the Process Table on SAPMMC

3) Right click on J2EE dispatcher and choose J2EE Telnet

4) Log in

5) Type "lsc" to see all the nodes in the cluster

6) Type jump <ID to the servernode> i.e: jump 1337754150

7) Type add dbpool

😎 Now you can use the command TEST_DS to test the datasource

Test your datasource with test_ds <dataource> <sql query>

i.e test_ds mySource Select * from myTable

if you get a result and no errors, your datasource should be correct.

If not, then log into VA and check your datasource properties. i.e maybe the vendor is not set correct...

Hope you figure it out.. If not, you now where the error is

Former Member
0 Kudos

Hi Sarika,

Create Development component.

In your component controller of WebDynpro Component add your database related code.like getting connection,registering connection etc.

This approach is much like all java applications connecting with oracle.

It wont be a big deal.Start your sample application.

If you need more info let me know.

Regards,

Karthick

Former Member
0 Kudos

Hi Karthick,

i tried in this way but my application is giving me this error.

java.lang.NoClassDefFoundError: oracle/jdbc/driver/OracleDriver

Could u help me plz?

Regards,

Sarika.

Former Member
0 Kudos

Hey Sarika

What does your connection look like?

Have you added your connection in Visual Administrator like i told you and created an alias?

If so, you can write this in your code:

InitialContext ctx = new InitialContext();

javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup("jdbc/<yourAliasFromVA");

java.sql.Connection con = ds.getConnection();

java.sql.Statement stmt = con.createStatement();

ResultSet rs = stmt.executeQuery("SELECT * FROM myTalbe");

I hope this helps you out!

Former Member
0 Kudos

Hi Sarika,

This document might help you:

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/how to install and configure external drivers for jdbc and jms adapters.doc

Regards,

Satyajit.

Former Member
0 Kudos

Thanks for your quick reply!

I am trying in another way.I've created a WD application and in custom controller I've put the code for connection, copying the retrived data into context and trying to display the data in one view.

CODE:

DriverManager.registerDriver(

new oracle.jdbc.driver.OracleDriver());

Connection conn = DriverManager.getConnection( "jdbc:oracle:thin:@oracle server ip:port:sid",

"user name",

"password");

Statement stmt = conn.createStatement();

ResultSet rs = stmt.executeQuery("select * from table");

if (rs != null)

{

while ( rs.next() )

{

//code for copying data into context

}

}

stmt.close();

conn.close();

Error(No class defination found) is at first line i.e. new oracle.jdbc.driver.OracleDriver().

I've put classes.zip in lib and build path as well.

Regards,

Sarika.

Former Member
0 Kudos

Hi Sarika,

See this links

It explains in detail

Hope this helps you

Regards

Rohit

Message was edited by: Rohit Radhakrishnan