File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Calling Stored Procedures in JavaScript ??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Calling Stored Procedures in JavaScript ???" Watch "Calling Stored Procedures in JavaScript ???" New topic

Calling Stored Procedures in JavaScript ???

Sudeep Agrawal
Ranch Hand

Joined: May 31, 2006
Posts: 34
Hi :
I wanted to know if there is a way I can make calls to a Oracle [or any other] Stored-procedures / functions in a JavaScript. The idea is to have one page (jsp) that has the form with maybe a userName and password and on the Submit button I would like it to talk to the stored procedure and tell me if the user is valid or not.

Right now I have a quick solution which is to build a second JSP page to have all the DB stuff in it. So when the Submit button is clicked, the second page is called, which inturn talks to DB via. SP and determines if the user is valid or not.
I was wondering if there is a way to eliminate the use of this second page.
ANY IDEAS .... ???

there may be a way for the scenario , BUT what I am really looking for is if there is a way to call a Storedprocedure in a Java Script.
[ June 07, 2006: Message edited by: Sudeep Agrawal ]
stu derby
Ranch Hand

Joined: Dec 15, 2005
Posts: 333

If you really really want to have the call to the database be executed from the browser, you will have to write an applet. However, that also has problems because standard Java security only lets applets open connections to the server from which they were served. In other words, either your database has to be the same host as your web app server, you have to do something very tricky to proxy a network connection through your web app server to your DB, or you have to somehow get your applet authorized on each host that needs to run it. I know the latter can be done, but I don't write applets and don't now how.
I agree. Here's the link:
subject: Calling Stored Procedures in JavaScript ???
It's not a secret anymore!