These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Need help with ADBC to Access DB

shawnash
Registered: Dec 16 2009
Posts: 48

Hello,

I am trying to connect to an access DB with Acrobat 5. I used the code below, but got the following error - ReferenceError: stmt is not defined undefined. Can you tell me how to connect to access DB in Acrobat 5?

var conn = ADBC.newConnection( "PAF" );
var stmt = conn.newStatement(); // create a Statement Object
if (conn == null)
throw "Null Connection Object";
if (stmt == null)
throw "Null Statement Object";
stmt.execute( "SELECT * FROM Positions" ); // issue SQL query

My Product Information:
Acrobat Standard 5.x or older, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2399
You need to place this line:
if (conn == null)throw "Null Connection Object";

before this line:
var stmt = conn.newStatement(); // create a Statement Object
The problem is probably that the connection to the database fails.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

shawnash
Registered: Dec 16 2009
Posts: 48
I tried it in the order you suggested and got this error:

ReferenceError: stmt is not defined
undefined

What am I doing wrong?

Thanks, Shawn
try67
Expert
Registered: Oct 30 2008
Posts: 2399
As I said, the problem is probably with your DB connection.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

shawnash
Registered: Dec 16 2009
Posts: 48
My ODBC is set up correctly. I have the ODBC setup as system and it is on PC. Is there more setup that needs to be done to connect to the Access database other than ODBC?