on 03-09-2006 6:17 PM
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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.
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!!
Hi Javier,
Can you check in Visual Administrator tool "JNDI Registry" for jdbc/PDIM.
Thanks and Regards,
Rohit Jaiswal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please try the following
Context ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("jdbc/PDIM");
con = ds.getConnection();
Regards, Anilkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Try the below code.
try {
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("jdbc/PDIM");
Connection con = ds.getConnection();
........
}
Regards,
Rathna.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.