Skip to Content
author's profile photo Former Member
Former Member

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

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jan 21, 2008 at 07:11 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.