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.