Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Javascript, ODBC, and Oracle functions returning cursors
On 20 Aug 2004 16:32:37 -0700, in comp.lang.javascript
dba_222_at_yahoo.com (Roger Redford) wrote:
>| Dear Experts,
>|
>| I'm attempting to marry a system to an Oracle 817 datbase.
>| Oracle is my specialty, the back end mainly, so I don't
>| know much about java or javascript.
>|
>| The system uses javascript to make ODBC calls to the db.
>|
>| The particular system I'm working with, will not work
>| with an Oracle stored procedure I'm told. However, it
>| will work with a stored function.
>|
>| I made a simple function in Oracle to return a single
>| integer. It works in sqlplus, but not via javascript.
[snip 2 end]
Javascrit comes in 2 flavours: client-side (that appears within the webpage). This can only manipulate items on the webpage. It can not open files or databases.
Server-side: also known as JScript. This allows you to do all the file / database manipulation stuff. Check with your web people as to what web server they are running. If IIS then ASP/JScript, ASP/VBScript or PHP will do. If any other server then check what server-side language they support.
Sample listed below:
<%_at_LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%> <!--#include file="../Connections/ELVASS.asp" --> <%
//--- global variables
var fname="", fExt="", TPName="", QName="", Ver="", AppDt="",
mainID=0;
var fso, f2;
var src="", dst = "", wrd="";
function WriteFormData( mainid, cid, type, fname )
{
//--- use this syntax for insert, update and delete queries
var w = Server.CreateObject('ADODB.Command'); w.ActiveConnection = MM_ELVASS_STRING; w.CommandText = "INSERT INTO forms (fk_mainID, fk_cid,type,filename) Values (" + mainid + "," + cid + ",\"" + type + "\",\"" + fname + "\")";
w.Execute(); w.ActiveConnection.Close();
//--- get general information
//--- use this syntax for select queries
var db = Server.CreateObject("ADODB.Recordset");
db.ActiveConnection = MM_ELVASS_STRING;
db.Source = "SELECT main.id form main WHERE fk_TrainingPackage=" +
tpid + " AND fkQualID=" + qid;
db.CursorType = 0; db.CursorLocation = 2; db.LockType = 1; db.Open();
//--- do something db.moveNext();