cancel
Showing results for 
Search instead for 
Did you mean: 

Java Webdynpro to SQL Server with normal JDBC or SQLJ?

Former Member
0 Kudos

Hi guys,

I am going to create some tables on the SAP Portal SQL Server database and I will need to add, edit, update etc....

I am new to Java Webdynpro and would like to know the BEST PRACTICE for connecting to the SQL Server database. I am familiar with the normal JDBC ways of doing this.....but am now also reading about the SAP Java Persistence Framework.

So should I use normal JDBC like in a normal Java servlet apps etc.....or must I rather go with the SAP Java Persistence Framework using SQLJ etc??

Also, I created a "Dictionary Project" to create my database tables.....then deployed the SDA file to SQL Server....all 100%......do I need to add that project to my Webdynpro project? If so how is that done?

Basically I am wanting the easiest a recommended way of using Java Webdynpro and SQL Server....

Thanks so much for the help, I really appreciate it!!

Lynton

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Lynton,

I have done the webdynpro to sqlserver 2005 database connection and the way I did is like this :

1.Create an EJB Module project.In that create a stateless session bean and give your JDBC connection in that.Also provide the sql statements.

2.Create the jar for this EJB Module project

3.Create an Enterprise Application Project and add the jar file to this Enterprise Application Project.

4. Create the Ear file out of this Enterprise Application Project.

5. Deploy the ear file onto J2EE engine.

Also, You have to give the datasource name and the username and password in the Visual Administrator-JDBC Connector.

Now,

6.Create the webdynpro project and give references to the Ear and EJB Module project in Build Path,Webdynpro References and in Project References

7. In the view implementation or component controller implementation,lookup for the EJB,create the EJB home and remote object and access the EJB methods to get the data from sql tables.

Hope you got some idea.Please let me know if you have any further questions.

Thanks

Kukku

Former Member
0 Kudos

Hi Kukku,

So are these the required steps you would recommend? Would you ever say that I should put everything into the Java Webdynpro project and forget about making an EJB project etc? It just seems that debugging may be much easier if I have everything together....what you think?

Can you send me some example code for getting the connection in your EJB project?

Thanks for the help, I really appreciate it

Lynton

PradeepBondla
Active Contributor
0 Kudos
Former Member
0 Kudos

Hi Pradeep,

Thanks....I will check that out as well.....

Lynton

Former Member
0 Kudos

Hi,

Following are the options

1) Dictionary Object-> JPA-> EJB-> Ejb Model-> WD

2) Dictionary Object-> JPA-> EJB-> Ejb Model-> WD

3) Dictionary Object-> JPA-> Java Beans-> WD

Once you decide on which one to go for we can discuss things in detail.

JPA can be replaced with JDBC calls if you are sure that your backend is not going to change(Always SQL Server) then you can use even vendor SQL too..

Regards

Ayyapparaj

Former Member
0 Kudos

Hi Ayyapparaj,

Thanks for the quick response.....I would like to use the way you recommend and which is easy to integrate into my Java Webdynpro.

I would like my connection details to be outside of the code if possible.....and use a JNDI lookup maybe?

I usually do ABAP Webdynpro so sorry for the silly questions

Thanks again, I will send you some points

Lynton