Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Database Connection

Avatar

Former Community Member
Im new to working with Livecycle. I am attempting to connect to a SQL database. Im able to setup the connection easy enough and select the table i want to query, but when I enter the field in to the binding section and test it. the field only displays the first value. Ive tied it different ways with different types of objects (list box, combo box, ect) .any ideas what Im missing...?
64 Replies

Avatar

Level 1
Hi Paul,



Here is my issue and I hope you can help.

I want to have a submit button on a form, that when clicked by the user can take the data and add it the database table which i made the connection to and of which the fields in the form were based on. Could you help with this or direct me to somewhere I can follow. It would be much appreciated.



Thanks,



Anthony

Avatar

Former Community Member
What type of Database is it? In most cases you will need to do two operations. One is to create the new record in the DB and 2 update the record that was just added using the update() method.

Avatar

Level 1
Thanks for your prompt response.



The database is Oracle. In oracle i have already created the table space and loaded just one table with 3 columns, no rows of data. I have used the 3 column names to create the form fields. I now ant to place a submit button that when clicked on. Will send the data to and populate the columns in the table space in a dataware house.



So for example, I have a Table1 with 3 columns- column A, column B, column C that are empty. When the user receives the form it will have 3 fields binded to the 3 columns, and fill it out, it will now take the information and populate the 3 columns so now in the table will be 3 columns and 1 row. When a second, third and so forth fill out the form, it will know to append the table space and not do an insert or overwrite previous data.



Let me know if you need further information.



Thanks again

Avatar

Former Community Member
Then what I recommen is to have the user submit the data from thre form to an intermediary program that will recieve the data and write it to the data base on behalf of the user. This program can be written in any kind of programming language but it must run on the web server.



You can write to the database directly from the form using OLEDB connections but it requires you to create a DSN on each machine. This becomes an administrative nighmare as user will not know how to do this as well as having any one who gets the form to connect to the DB.



The single program approach keeps the data base connectivity in a single place so that if anything were to change in that DB you would only have to update 1 single program.

Avatar

Former Community Member
Hello Paul:



Could you send me this code as well. I know it is an older post but I am having the same problem. I Get Connection for Source TIMS failed because the environment is not trusted.



Thank you Paul



Jeff

Avatar

Former Community Member
I do not have source for that itermediary program. I was simply recommending an approach. The program that you create will be dependant on the web server used. I am sure that there are many examples in th eweb of the program that you will need.

Avatar

Former Community Member
Paul-



I'm trying to create a pdf form with which a user enters into a field a customer # and the form populates some other fields (like name, address etc.) with values retrieved from an SQL Query based on the cust #. (Something like Select * From customers Where custID = uh, 'the value entered by the user') I'm having (I think) a similar issue as Jason and others....I would like to query SQL in my data connection to bring back and display a specific record and not just the first record in the table. Am using CS3 Acrobat/LiveCycle Designer 8.0 and can't get it to work. Could you possibly send me the same code you sent him and others? Or possibly any other info that would point me in the right direction?



Thanks for your time



Rob

Avatar

Former Community Member
I can send you the sample I used but I will need your email address to send it to.

Avatar

Former Community Member
Wow, I didnt expect such a fast response...thanks. My email is rob@chameleon59.com

best,

rob

Avatar

Level 10
Hi Paul,



I would be grateful if you could also send it to me at niall.odonovan@assurehsc.ie Thanks!

Avatar

Level 1
Hello everyone,



I am working on a Form with Livecycle in the exact same way. I've been using "Next" and "previous" buttons to cycle through the records, but it would be great to type in a record number and have it pop the other fields.



Also, if a sample doesn't help me figure it out, i would like to take those populated fields, and use them to reference another data connection. Some times your SQL data is in more than one table.



Paul, if you are still watching this forum, the sample you gave would be great for me to look at. narmstrong@smilebpi.com



Or if someone else has the sample, feel free to email it to me.



thank you all!

Avatar

Level 1
Paul,



I'm looking at them right now. Thank you very much. This seems to be far more simple than another example i was trying to learn. I will work to adapt this to my database, and i'll get back to you if i need more help....which i probably will.



Nick

Avatar

Level 1
Paul,



I am about to try the PDF on my database, we'll see if I've adapted the script the right way.



You sent me 2 XDP files, is the difference that one is written in Java, and the other in Formcalc?



Thank you,

Nick

Avatar

Level 1
Paul,



Adobe gives me this error: Couldn't post data ".



I modified the javascript to fit my data connection and table names, but i'm not sure if it is correct:



form1.#subform[0].Button5::click - (JavaScript, server)

//xfa.sourceSet.ftmServiceCalls.close();



//set up sql call to DB to get specifics about employee



xfa.sourceSet.ftmServiceCalls.nodes.item(1).query.setAttribute("text", "commandType");

xfa.sourceSet.ftmServiceCalls.nodes.item(1).query.select.nodes.item(0).value = "Select * from servicecalls where ServiceId = '" + ServiceId.rawValue + "'";

//app.alert(xfa.sourceSet.ftmServiceCalls.nodes.item(1).query.select.nodes.item(0).value);



//now connect to DB and get a record

xfa.sourceSet.ftmServiceCalls.open()



Also, for some reason, the "Service Id" box populates with a number right away, is there a way to have it be blank when i start up?



Thank you,

Nick

Avatar

Former Community Member
In the Data Connection wizard on the last panel there is a checkbox for delayed open. make sure it is chcked. This will cause the database connection to be delayed until you issue an open() statement. If you do not the data connection is established when the form loads and as such the 1st record is returned and bound to your form.

Avatar

Former Community Member
Hi Paul,



could you send me the data view sample files as well?



Thanks in advance!



uli_svw (at) gmx.net

Avatar

Level 9

Hi Paul,

could you send me the data view sample files as well?

dkinsley@twcny.rr.com

Thanks,

-Don

Avatar

Former Community Member
Can I have a sample too?

Probably I can modify it to solve my newest problem... :/

diefeuerolke@web.de