Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

published pdf form is unable to connect with database

Level 1
Level 1

Hi Guys!

I have created a PDF form using Adobe Live Cycle Designer which have some text fields namely RECORD and NAME. I have connected this form with a Database. When I enter a record in the RECORD number field the NAME field of this form has been populated with the help of XFA Script which is written on the exit event of the RECORD text field. When we publish this form, a new interactive PDF is created which works fine and populates the NAME field from the an SQL database but when I access this PDF form (which is located on a shared location) from some another location (not on the same machine where i designed this form) it is unable to connect to the database and does not work as expected.

I think there is some thing i am missing for the database connectivity.

If any body on this forum can help me out.


Here is the Script for the above form which i used to populate the NAME FIELD on the basis of enetered RECORD number.

----- Document.Page1.txt_MRN::exit: - (JavaScript, client) -----------------------------------------

/* This dropdown list object will populate two columns with data from a data connection.

sDataConnectionName - name of the data connection to get the data from.  Note the data connection will appear in the Data View.
sColHiddenValue  - this is the hidden value column of the dropdown.  Specify the table column name used for populating.
sColDisplayText  - this is the display text column of the dropdown.  Specify the table column name used for populating.

These variables must be assigned for this script to run correctly.  Replace <value> with the correct value.

var sDataConnectionName = "DataSource";  // example - var sDataConnectionName = "MyDataConnection";
var sColHiddenValue  = "RecordNum";   // example - var sColHiddenValue = "MyIndexValue";
var sColDisplayText  = "Name";   // example - var sColDisplayText = "MyDescription"

// Search for sourceSet node which matchs the DataConnection name
var nIndex = 0;
while(xfa.sourceSet.nodes.item(nIndex).name != sDataConnectionName)
//var oDB = xfa.sourceSet.nodes.item(nIndex);
var oDB = xfa.sourceSet.nodes.item(nIndex).clone(1);;

// Search node with the class name "command"
var nDBIndex = 0;
while(oDB.nodes.item(nDBIndex).className != "command")
// Backup the original settings before assigning BOF and EOF to stay
var sBOFBackup = oDB.nodes.item(nDBIndex).query.recordSet.getAttribute("bofAction");
var sEOFBackup = oDB.nodes.item(nDBIndex).query.recordSet.getAttribute("eofAction");

oDB.nodes.item(nDBIndex).query.recordSet.setAttribute("stayBOF", "bofAction");
oDB.nodes.item(nDBIndex).query.recordSet.setAttribute("stayEOF", "eofAction");

// Clear the list

// Search for the record node with the matching Data Connection name
nIndex = 0;
while(xfa.record.nodes.item(nIndex).name != sDataConnectionName)
var oRecord = xfa.record.nodes.item(nIndex);
// Find the value node
var oValueNode   = null;
var oTextNode   =  null;
var sRecordNum  =  $.rawValue;

for(var nColIndex = 0; nColIndex < oRecord.nodes.length; nColIndex++)
if(oRecord.nodes.item(nColIndex).name == sColHiddenValue)
  oValueNode = oRecord.nodes.item(nColIndex);
else if(oRecord.nodes.item(nColIndex).name == sColDisplayText)
  oTextNode = oRecord.nodes.item(nColIndex);
var found= 0;

if (oValueNode.value== sRecordNum)
  txt_FirstName.rawValue = oTextNode.value;
  txt_LastName.rawValue = oTextNode.value;
  found = 1;
  //this.addItem(oTextNode.value, oValueNode.value);;

   if (found == 0)
    txt_FirstName.rawValue = "";
    txt_LastName.rawValue = "";

// Restore the original settings
oDB.nodes.item(nDBIndex).query.recordSet.setAttribute(sBOFBackup, "bofAction");
oDB.nodes.item(nDBIndex).query.recordSet.setAttribute(sEOFBackup, "eofAction");

// Close connection


3 Replies
Level 10
Level 10

Did you define the DSN that you created on the local machine on the machine that is accessing the form? Each machine must have a DSN with the exact same name so that it can leverage the ODBC data connections. Also the database driver for your particular database must be on each machine.


Level 1
Level 1

I have defined the DSN on the local machine that is accessing the form and this machine has DSN with the exact same name . The database driver exists on each machine but the same problem of database connectivity persists when i access the from from other machine.

Below mention is the encountered error of the Form

GeneralError: Operation failed.[0]:Page1[0]:txt_MRN[0]:exit
Connection for Source "DataConnectionName we defined for Data View" failed because the environment is not trusted.



Message was edited by: abdulhafeez001

Level 1
Level 1

Finally achived the database connectivity for the published pdf form developed in the Adobe LiveCycle Designer 8.0.

There must be the same driver version of the DSN on both machines. The machine which published the form and the one accessing it.

Use the Admin account to add the DSN on both machines.

Get rid of the error: Connection for Source "DataConnectionName" failed because the environment is not trusted.