cancel
Showing results for 
Search instead for 
Did you mean: 

get data from sqlserver thru Model

jerin_mathew
Explorer
0 Kudos

hi

i want to access data from MS SQL Server database thru a WebDynpro model application.

so i did install the microsoft jdbc driver and registed that in Visual Administrator.

now what type of model class should i create?

also

in normal java app we use to give all the conn parameters including ConnectionURL etc in the code itself will it differ in webdynpro (since we are creating a new alias in Visual Admin can we call the alias to get the connection? )

any code snippets will be helpful

Thanks in Advance

Jer

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Jer,

I can send you the project latest by tomorrow.

Because still i am working on that.

But currently it works for SAP DB. If you want for SQL Server you need to modify the code little bit.(DataType mappings)

I want to introduce Mapping file that will generate the Java types based on the DB (SQL Server, SAP DB etc)

Regards, Anilkumar

jerin_mathew
Explorer
0 Kudos

hi anil,

Thanks and waiting for your project

Jer

Former Member
0 Kudos

HI Anil,

I'm very interested in the issue.

I have a simple Model based upon a DB tables,

and I would avoid using EJB.

..and I would like to use WebDynpro...

Could you sent you prject to me ? pedrobrio@yahoo.it

Thanks in advance

Former Member
0 Kudos

Hi Anil,

i'm also very interested. Could you send me your project please ?!

Thanks!!

Former Member
0 Kudos

I'm also very interested in this. I'm doing a Demo project where we want to get data from two SAP systems and one (or more) sqlserver based systems. Can I have a look at that file?

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi ,

Please find the link below.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/java/simple java bean generator for database.pdf

Regards, Anilkumar

Former Member
0 Kudos

Hi Jer,

Yes.You can create a simple java application that will create simple bean containing Java classes for each(required) table in the SQL server and you can import that simpleBean.jar in webdynpro using the JavaBeanImporter.

I have created a simple java application for the same .If you want i share oit for you )

Regards,

Anilkumar

jerin_mathew
Explorer
0 Kudos

Hi Anil,

Sorry for the late reply...

It would be nice if u can get so that i can understant if ive done it in the right way

mailid: jerinjm @ yahoo.com

Jer

Former Member
0 Kudos

Hi Jer,

You have to create a new datasource through visual admin and configure your uploaded driver class for this datasource. Now from your code you can access this datasource with its alias name.

For connecting to database you can create an EJB project and do the communication with database from that. For accessing the EJB project you can just refer the project from your WD project(w/o creating a model) or you can expose your ejb business methods as local web service and create a web service model out of it. Both are very much possible in NWDS.

For connecting to mssql db, declare an alias by selecting the datasource in the ejb application project. This can be done by right cicking the ejb application project and selecting add datasource.xml. After you do this you can do a jndi look up for this alias from your ejb code. Once you get the datasource you can get connection by calling ds.getConnection() method.

Let us know if you have any specific query.

Regards,

Shubhadip

jerin_mathew
Explorer
0 Kudos

hi Shubhadip,

Thanks for the reply

i got another doubt

can i create a simple Java Application with needed methods and properties and import it as a Java Bean Model in webdynpro? (i did'nt actually do it and see)

Thanks in advance

Jer

Former Member
0 Kudos

Hi Jer,

Yes you can access the bean in web dynpro by giving a sharing reference to the bean in the properties tab of the web dynpro app.

you should refer it as local/<ear file name>

Then you can use it by just importing the bean.

Regards

Prakash