cancel
Showing results for 
Search instead for 
Did you mean: 

How to define datasource in data-source-aliase.xml

Former Member
0 Kudos

Hi,

I have created a new Database in SAPDB and i have registered the Data Source in Netweaver Server using Visual Administration tool witn datasource name say "TestDataSource"

Now i want to connect my application to the databse using the datasource which i have created.

When i open <b>data-source-aliase.xml</b> file i found the "data-source-name" declared as "${com.sap.datasource.default}" as given below,

<b><data-source-name>${com.sap.datasource.default}</data-source-name></b>

How can i define newly created datasource instead of com.sap.datasource.default?

I tried to deploy my application by replacing the "${com.sap.datasource.default}" to "TestDataSource"

but i got deployment exception.

Could you please help me how to define the datasources in data-source-aliase.xml?

Thanks and Regards,

Sudheesh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sudheesh,

Try to do like this...

[code]<?xml version="1.0"?>

<data-source-aliases>

<aliases>

<data-source-name> ${com.sap.datasource.default} </data-source-name>

<alias>TestDataSource</alias>

</aliases>

</data-source-aliases>[/code]

Note: In the generated XML, the name

${com.sap.datasource.default} represents the default

DataSource stored in the server.

Check this link it may be helpful.

Hope this solves the problem.

Regards,

Maheswaran.B

Answers (4)

Answers (4)

former_member184385
Active Participant
0 Kudos

Hi,

1) you have also the option to define a DS in visual admin .. gui env. .. good to make the first steps.

2) once you defined a DS, like in 1, in your ejb module project, you can reference this DS in the DS reference section .. you can also export the DS as xml document for later automatic deployment, say with the admin shell.

Regards

Gregor

Former Member
0 Kudos

Hi gregor

Is it possible to create a DataSource.xml with NWDS( not with visual admin).

Also i had created a DS using the visual admin , but wanted to know where is this configuration stored . Is this stored in DB or some files , as i thought the DS configuartion details might be written to file system , but when i checked i was unable to find that ..

regards

rajesh kr

Former Member
0 Kudos

Hi

How do you create a data-source-aliase.xml.Is it possible through NW studio?

please let me know on this as rt now Iam creating through admin console.

regards

rajesh kr

Former Member
0 Kudos

Hello Rajesh,

I think the datasource-aliase.xml can be created through NDS(Netweaver developer Studio). Please create a enterprise application project(by clicking file -> new-> projects -> J2EE -> Enterprise aplication project)[I hope you have already created it :-)]. Once you have created the project, you can create the datasource-aliase.xml by invoking the context menu on the created enterprise project (you should be in the J2ee perspective).

If you want to create a new Data-Source, you can create it using Visual Administration console available with netweaver (will be found in <installation directory>:\usr\sap\J2E\JC00\j2ee\admin).

Visual Administration -> Server -> services -> JDBC Connector...

Best regards,

Sudheesh...

Former Member
0 Kudos

Hi,

Please check if the xml is in the format below

<data-source-aliases>

<aliases>

<data-source-name>TestDataSource</data-source-name>

<alias>alias/TestDataSource</alias>

</aliases>

</data-source-aliases>

you will have to refer this DataSource (in the java code) using the alias name 'alias/TestDataSource'.

Regards,

S.Divakar

Former Member
0 Kudos

Hi,

Without replacing default data source, try adding a new <data-source-name> in new entry.

Also, refer this for more information.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/fe2896e5-0601-0010-91b8-f80...

Hope this helps.

Regards,

Uma