Hello,

I want to create database on SQL Server using Javascript and HTML. User will input following data. Server Name, Database name, File Sizes. When I will click "Submit" button database should be created on Selected server with entered name. I am using Client side HTML and Javascript.
we need to create database according to some standards thus we are preparing graphical user interface.
Quick response will be appreciated.

Thanks, Rahul

Recommended Answers

@Thirusha correction, you can do [URL="http://www.google.co.uk/#hl=en&source=hp&q=ajax+database+connectivity&btnG=Google+Search&meta=&aq=8&oq=ajax+database+&fp=c662ce1e81ac315b"]DB connectivity with AJAX[/URL] which is essentially JavaScript ;)

Jump to Post

All 8 Replies

Re: How to Create database in SQL Server using Javascript & HTML? 80 80

I dont think you can do that, you are going to need a server side language, like ASP, Java, PHP etc that will be able to communicate with the database.

Re: How to Create database in SQL Server using Javascript & HTML? 80 80

@Thirusha correction, you can do DB connectivity with AJAX which is essentially JavaScript ;)

commented: nice to see you solving in the mssql forum :) +6
Re: How to Create database in SQL Server using Javascript & HTML? 80 80

Hello,

I want to create database on SQL Server using Javascript and HTML. User will input following data. Server Name, Database name, File Sizes. When I will click "Submit" button database should be created on Selected server with entered name. I am using Client side HTML and Javascript.
we need to create database according to some standards thus we are preparing graphical user interface.
Quick response will be appreciated.

Thanks, Rahul

Impossible. Javascript is not designed to do work on another server, it is client side software that only runs on the client. Both HTML and JavaScript can post to a cgi which could do something like this. If the server name entered also hosts the cgi, Javascript could post the instructions to the server name's cgi and let it do the work. That or the client hosts the cgi and the user account has access to the server name.

Re: How to Create database in SQL Server using Javascript & HTML? 80 80

@Peter_budo, based on his question, i think that i am correct in saying that it cant be done, one can use ajax, but you will still need a server side language, one cannot connect directly to the database just using javascript.

Re: How to Create database in SQL Server using Javascript & HTML? 80 80

We may never know as Rahul002 was so rude as to never reply what he/she is up to...

Re: How to Create database in SQL Server using Javascript & HTML? 80 80

@Thirusha correction, you can do DB connectivity with AJAX which is essentially JavaScript ;)

Sorry, I forgot about AJAX. It isn't just JavaScript. It is a combination of JavaScript and XMLA. One of the key phrases in the AJAX tutorial is "AJAX uses the XMLHttpRequest object". This is, in effect your cgi link I was talking about. The intent in the tutorial was to connect to a server that had your DB interface already built.
I assumed that the request was to create a database on the client since JavaScript is and remains client-side code only. I can't think of any valid reason for creating a database on the server-side. If he is dead-set on creating a DB on the client side, I suppose it is possible using AJAX, I still say it is impossible using JavaScript. You would need an unnamed SQL Server object running on the client, the person running the web page would need admin rights on SQL, you would connect using the local IP address, verify the DB doesn't exist on the client server and create it.
I sincerely hope and pray that using AJAX to create a DB on my server is impossible as well. I hate to think what a set of malware could do to me being able to connect to me, as me, just by setting up a web page. I hate what they can do now that requires a constant update of sentry software.

Re: How to Create database in SQL Server using Javascript & HTML? 80 80

@Thirusha correction, you can do DB connectivity with AJAX which is essentially JavaScript ;)

Hello,

Thanks for your response. My requirement was to create database on SQL 2005 Server with my local machine using any language. But we cant use any application server for this, Hence i wanted to do this using client side scripting. I will find is AJAX suitable for this sceneario or not. I really appreciate your efforts.

Thanks,
Rahul

Re: How to Create database in SQL Server using Javascript & HTML? 80 80

Again, I sincerely hope you find it is IMPOSSIBLE to put a DB on my SQL server if I happen to link to your web site. There are enough security holes to drive a mack truck through without adding this one to it.
I'm kind of conflicted because I usually don't want someone to fail in their endevours, but I definitely hope you fail.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.