cancel
Showing results for 
Search instead for 
Did you mean: 

jdbc error

Former Member
0 Kudos

hi,

if i am using backend ms access file in webdynpro java.if some error has come in running time

""com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Object not found in lookup of myname""**The my code part is

InitialContext ctx;

try {

ctx = new InitialContext();

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

Connection con = ds.getConnection();

String SelectStmt = "select name from Table1" ;

PreparedStatement stmt = con.prepareStatement(SelectStmt);

ResultSet resultSet = stmt.executeQuery();

while (resultSet.next())

{

IWDNodeElement element = wdContext.nodeNode().createElement();

element.setAttributeValue("name", resultSet.getString("name"));

wdContext.nodeNode().addElement(element);

}

}catch (Exception e) {

// TODO: handle exception

wdComponentAPI.getMessageManager().reportSuccess("ahdsjfahdsj " + e);

}

so send me correct solution

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Patrick,

You have to specify a correct data source name, You can find it in Visual Administrator-> services->JDBC->Data Source Name..

In lookup method, specify as


DataSource ds = (DataSource)new InitialContext().lookup( "jdbc/<DSName>");

Regards

Vinod V

Edited by: Vinod V on Aug 13, 2008 11:54 AM

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Patrick,

check for JNDI name ..

go to EjbProject->ejb-j2ee-engine.xml..double click on it

n chk whethr u hav givn the same jndi name or nt??

Regards,

Khushboo

siddharth_jain
Active Contributor
0 Kudos

Hi,

you can also do the following .

-- Create an Enterprise application project and right click on the project a context menu will come up.

Choose a option Data source Alias (Some thing like that)

give any name and build and deploy the EAR file.

Now in your webdynpro code you can LookUp the Alias like this ctx.lookup("jdbc/<DS Alias Name>")

Hope this will help.

Regards,

Siddharth