cancel
Showing results for 
Search instead for 
Did you mean: 

what is missing ?? - JDBC and webdynpro

Former Member
0 Kudos

Hello!!:

I'm traying to get some data vias JDBC from a Data base to display info in a webdynpro project's view.

The code is:

public void wdDoInit()

{

//@@begin wdDoInit()

wdContext.nodeAddressbook().invalidate();

IPrivateAddressbookView.IAddressbookNode

addressNode = wdContext.nodeAddressbook();

IPrivateAddressbookView.IAddressbookElement addressElement;

try {

InitialContext ctx = new InitialContext();

Object obj = (Object)ctx.lookup("jdbc/PDIM");

DataSource ds = (DataSource)PortableRemoteObject.narrow(obj, DataSource.class);

Connection con = ds.getConnection();

Statement stmt = con.createStatement();

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

String nombre;

String departamento;

...............

.............

}

con.close();

}catch (SQLException e) {

// handle exception

System.out.println(e.getCause());

System.out.println(e.getMessage());

}catch (NamingException e) {

// handle exception

System.out.println(e.getCause());

System.out.println(e.getMessage());

}catch (Exception e){

// handle exception

System.out.println(e.getCause());

System.out.println(e.getMessage());

}

at line:

Object obj = (Object)ctx.lookup("jdbc/PDIM"); an Naming exception is throw, it says:

com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Object not found in lookup of PDIM.

PDIM = alias and name of de data base.

The connector and alias are well difine in the portal as I look up for some steps to do it at the SDN an all of them were well done. I was wondering if there's some file, as data-source-aliases.xml or something like that's missing (what and where should I put it?).

All the examples using JDBC that I saw were with EJB + Web dynpro, not just Webdynpro and JDBC. THERE IS NOT EJB ON MY PROJECT.

Thanks a lot for your time.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi,

Please can u tell me how to connect JDBC to WebDynpro to get and set the data..

I tried using EJBs but i dnt know how to retrieve the data using EJBs..

Please can you give me a sample project or tutorial using JDBC and WebDynpro..

Thanks and Regards,

Poonam

Former Member
0 Kudos

Hi,

1. Which DB are u using (Oracle, Access etc)?

2. Where have u created the alias name?

If u have created the alias name through windows Administrative Tool then u need to connect through a driver. But if u have added this DB as a data source in ur Webdynpro project then u can directly use it in ctx.lookup("");

U can create Java Dictionary in NDS and add it as a DataSource in an EJB. This EJB can be used to access DB.

Try running ur application without the string "jdbc".

Regards,

Piyush.

Former Member
0 Kudos

HI,

1_ I'm using Oracle.

2_ I need to use the systems that i has defined in the portal, what api i need use to do this??

The error is:

<b>com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Object not found in lookup PDIM</b>

thanks in advance.

Javier

Message was edited by: Javier Espeche Giani

Former Member
0 Kudos

Hi,

Check out whether u have done the following:

1. logon to visual administrator tool of the engine and click on Server0->Services->JDBC Connector.

2. As resource select Resources->DataSources->SAP<SID>DB.

3. In the Aliases list add the DB Alias SAP/PDIM.

Note:This should be added only if the alias does not exist.

Regards,

Nagarajan.

Former Member
0 Kudos

Nagarajan Kumarappan Thanks a lot for your answer.

You said:

"Note:This should be added only if the alias does not exist."

by that you mean "if the alias SAP/PDIM is NOT display on the aliases'list"

is it ok? or the alias could have been created from the portal side, this is

htp://<host>:50000/irj/portal --> system configurations --> portal content -->(from context menu) New --> System

THANKS!!

Former Member
0 Kudos

Hi,Piyush...

Can you please explain in detail how to retrieve database without using JDBC.can u plase give some simple example or tutorial.It will definatly greate help for me..

Sonal Shelke..

Former Member
0 Kudos

Hi Javier,

Can you check in Visual Administrator tool "JNDI Registry" for jdbc/PDIM.

Thanks and Regards,

Rohit Jaiswal

Former Member
0 Kudos

Please try the following

Context ctx = new InitialContext();

DataSource ds = (DataSource) ctx.lookup("jdbc/PDIM");

con = ds.getConnection();

Regards, Anilkumar

Former Member
0 Kudos

Hi

Try the below code.

try {

InitialContext ctx = new InitialContext();

DataSource ds = (DataSource)ctx.lookup("jdbc/PDIM");

Connection con = ds.getConnection();

........

}

Regards,

Rathna.

Former Member
0 Kudos

Thanks to answer Rathna Ramamoorthy but nothing chage...I'm getting the same error.

Did you import any *.jar or portal's api into the developer studio project?

Thanks.