cancel
Showing results for 
Search instead for 
Did you mean: 

How to Acess MAXDB table from Web Module Project of NWDS

former_member205363
Contributor
0 Kudos
61

Hi Friends,

I created Web Module Project in NWDS with JSP and Java class in side. I am using web.xml file also.

I struck at accessing MAXDB. could you provide provide steps to access database table from java class.

Regards,

Lakshmi Prasad.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Lakshmi

you Can enable that table as an webservice from R/3 and use that webservice as that you can use it as a web enabled service in NWDS and you can fetch data from MaxDB.

regards,

Sharma Kvbk.

Former Member
0 Kudos

Hi Lakshmi Prasad,

When you deploy the EAR with the webmodule, you need to have a file called "data-source-aliases.xml" with content as below, in your EARs META-INF folder

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE data-source-aliases SYSTEM 'data-source-aliases.dtd'>
<data-source-aliases>
  <aliases>
   <data-source-name>${com.sap.datasource.default}</data-source-name>
    <alias>TEST_DS</alias>
  </aliases>
</data-source-aliases>

This will create a datasource for you with name TEST_DS.

In your java code, you can lookup this datasource using below given code and get the JDBC Connection:


initialContext = new InitialContext();
dataSource = (DataSource) initialContext.lookup("jdbc/TEST_DS");
connection = m_dataSource.getConnection();

Thanks,

Sastry