You are currently viewing the BOOK: Beginning JavaScript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .

I'm working in chapter 10 of Beginning JavaScript. I'm trying to make a DSN-less connection to an Access database. I've searched the p2p forums and archives, but haven't seen any discussion of this topic. I've spent much time searching other sites for some discussion of this issue.

I'm working on a Win 98 machine with PWS installed. For testing, the database has just one table "names" which has tow fields "Firstname" and "Lastname." I can make this connection with a DSN and I can make a DSN-less connection in VBScript; however, I would like to be able to make an DSN-less connection in JavaScript because I will not have access to the server on which I will be deploying my finished products.

Following is some of the code with an explanation of some of the problems I have been having:

Thanks Hovik Melkomian. I'll give this a try. However, JavaScript does things a bit differently than VBScript. I can get the connection and recordset to work in VBScript, but I'm trying to develop JavaScript skill. I am aware that VBScript is closely married to ASP, but I think JavaScript should also work with ASP. As I mentioned above, I can get the connection to work with a DSN, but I want a DSN-less connection because I don't have ready access to the server to set up a DSN. And DSNs suffer a performance loss because the script has to keep running throug the registry to check the connection string rather than a direct connection with a DSN-less connection string.

Actually DNS is not good for web connections since u wont have much more facilities on WEB SERVER as u have on LOCALHOST (I think so). Yes u r right JavaScript can work with ASP too, but as I said I have not much experiance in SERVER CODING with JavaScript! I prefer to work with JavaScript, but in clint cide! In the other hand, Microsoft has back to JavaScript & u'll need to work with VBScript anymore...

The sample I gave u, is a DNS less connection & right now its working on server, so if u change it to JavaScript it should work too!

I'm guessing here, but maybe MapPath doesn't give the path in a suitable format for JS (since \ is a special char in JS, you have to double it up in paths). Just to see, try hard-coding the path and see if it connects then.

i already use that code (using ActiveXObject) but i get this message:
"This page is accessing a data source on another domain. Do you want to allow this?"
if my answer is Yes then the script has been run well but if my answer is No then there is nothing to run.
What should i do to hide or erase that message? why that message appear? help me please...

quote:Originally posted by zenitha
i already use that code (using ActiveXObject) but i get this message:
"This page is accessing a data source on another domain. Do you want to allow this?"
if my answer is Yes then the script has been run well but if my answer is No then there is nothing to run.
What should i do to hide or erase that message? why that message appear? help me please...