Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL database connection in javascript

Status
Not open for further replies.

whizzz

Programmer
Oct 19, 2003
32
IN

Dear All,
I want to do SQL database connection in javascript .
For that i'm using the server side javascript.

But my problem is that , i'm not able to do the connection ..

Code :

database.connect("SQLServer","NAMRATA12K","sa","MesuT123","AHD");

if(!database.connected())
document.write ("Error in connecting to database");
else
document.write ("Success in connecting to database");

But i'm getting the error as Doesn't support the object or method ..

Please give me some hint or any other solution for creating database connection in javascript.

Please reply to : namrata.parab@lntinfotech.com

Thank You .

Regards,
namrata.
 
Namrata,
Did you ever get this resolved? I am having the same problem.. any help would be greatly appreciated!

Thanks,
HaileyMarie
 
Security-wise what you are trying to do is NOT a good idea.

If I understand you correctly, you are writing javascript (which I take to mean synonmous with client-side browser code) that will connect to a SQL Server database.

This is a security risk as it places database connection code directly in the hands of your users (they can do VIEW SOURCE in the browser and see the database name, password, etc). And, furthermore, it will ONLY work for an Intranet app, which can get away with being less secure I suppose, but is still not a good practice.

Marshall and data you need between your client browser and web server sides of the house through pages and javascript/form variables.

TR
 
Thanks for the advise TR. I have been digging around and can't find a way to do this anyhow (don't even think it's possible) - so I am going to attempt to have JS open an ASP Page after the button fires off and have it all happen on a different (ASP) page.

Thanks again, it's nice to know the security risk involved.

HaileyMarie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top