cancel
Showing results for 
Search instead for 
Did you mean: 

Error while connecting to Access Database

Former Member
0 Kudos

hi

i am making an application using Access Database using the following code

*try {*

*Connection conn=null;*

*Statement s=null;*

*ResultSet rs=null;*

** **

** **

** **

*Context ctx=new InitialContext();*

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

** conn = ds.getConnection();**

** s = conn.createStatement();**

*rs = s.executeQuery("select empname from stable");*

** IPrivateApplic1View.IRsElement elm=null;**

** while (rs.next())**

** {**

** elm=wdContext.nodeRs().createRsElement();**

** elm.setValue(rs.getString(1));**

** wdContext.nodeRs().addElement(elm);**

** }**

** } catch (Exception e) {**

** **

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

** e.printStackTrace();**

** }**

but it is showing the error

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

Accepted Solutions (0)

Answers (5)

Answers (5)

siddharth_jain
Active Contributor
0 Kudos

Hi,

To use Access DB in Webdynpro you have to create a Data source in Visual Administrator under JDBC Connector option.

Then You can use the Data source Alias Defined for Access DB in Visual Admin for LookUp like This:

ctx.lookup(jdbc/<DS Alias Name")

Regards,

Siddharth

Former Member
0 Kudos

You must give a right Data Source name for the connection. You will find the same using Visual Administrator->Services->JDBC.

Specify the name at the code to get back-end access.

Regards

Vinod V

sureshmandalapu6
Active Contributor
0 Kudos

Hi

refer

[|]

[/thread/147169 [original link is broken]|/thread/147169 [original link is broken]]

thanks

suresh

Former Member
0 Kudos

Hi,

you are trying to connect Access Db via DSN, try to check created DSN is correct or not, check the name case of DSN is same or not coz DSN name is case sensitive.

From the error discription it seems failing at the look-up time. Plz check the DSN created in the Visaul Admin and try to run simple query,coz you need to create DSN in the Visaul Admin.

Regards,

Deepak

sureshmandalapu6
Active Contributor
0 Kudos

Hi viswas iyer ,

Check out the Database and database connection object.

Thanks

Suresh

Former Member
0 Kudos

hi

i have defined the in the DSN , it is not working in web Dynpro . however it is working in JAVA

Former Member
0 Kudos

hi,

where you have created DSN....???, in local machine or in the Sever using/via Visaul Admin.

Coz from Web Dynpro you need to create DSN in the Visaul Admin then it will work for you. In that you need to define all DSN related information. Then from your application you need to use created DSN name.

Regards,

Deepak