cancel
Showing results for 
Search instead for 
Did you mean: 

Where do i place these database connection codes.. Points awarded!!

Former Member
0 Kudos

Hi, i have actually posted to ask regarding database connections from my database MS SQL 2005 to my adobo form..

The thing is this, i need to have a database connection to my database which is MS SQL 2005 so that my Interactive form can retrieve data from the database to pre-fill the form when someone downloads my form..

The below code is given to me but i do not quite understand it, can someone explain to me where do i put them, how do i create a class and how to do it? Or is there another way u all know of?

Points awarded for any help at all!!

Thanks In Advance..

-


Hi Jing xuan,

it is just pure java programing.

you can create a class with following code.

InitialContext ctx = new InitialContext();

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

Connection adstatCon = ds.getConnection();

adstatCon .prepareStatement("YOUR SQL");

after you retrieved the data, you can store them in context which will be bind to your form. so your form will be populated.

Best regards,

John

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

The code represents a JDBC connection to your database table.

You can place the code anywhere depending on the functionality of your application. for. eg if i have a button called 'Download form' in the view which the user clicks to download the form, you can place the code in the onActionDownloadForm() method which would be the event handler for the action DownloadForm bound to the button.

In another case you can keep it in a custom method e.g. retrieveData() and call this method when the user wants to download the form.

You do not have to create any custom class if your using Web Dynpro for Java.

Hope this helps.