Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Javascript, ODBC, and Oracle functions returning cursors

Re: Javascript, ODBC, and Oracle functions returning cursors

From: Jeff North <jnorth_at_yourpantsbigpond.net.au>
Date: Sat, 21 Aug 2004 13:40:03 GMT
Message-ID: <uljei09io64s3911ivlu18f9uu5g1cok9f@4ax.com>


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" -->
<%

//--- get data from the webpage form
var tpid = Request.QueryString("tpid");
var qid = Request.QueryString("qid");
if( isNaN(tpid) || isNaN(qid) ) Response.Redirect("../menu.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();

while( !db.EOF )
{
	//--- do something
	db.moveNext();

}
db.Close();
%>

jnorth_at_yourpantsbigpond.net.au : Remove your pants to reply
Received on Sat Aug 21 2004 - 08:40:03 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US