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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JavaScript/vbscript + OLEDB + Oracle Stored Procedure

Status
Not open for further replies.

siddhanta

Programmer
Oct 8, 2016
3
0
0
IN
I have a HTA tool developed using JavaScript. It connects to backend Oracle database and perform the operation.

DMLs are running fine but PLSQL doesn't run.

Can someone please help me to run a Oracle stored procedure using OLEDB in JavaScript.

For normal sqls , am using below command

`

try {
var connection = new ActiveXObject('ADODB.Connection');
//alert(RepoConnStr);
connection.open(RepoConnStr);

}
catch (e) {
alert(e);
return;
}
try {
SQL = "SELECT unique job_name as job_name FROM DATPRD.JMS_JOB_INVENTORY";
var rows = new ActiveXObject("ADODB.Recordset");
rows.open(SQL,connection);
while(rows.EOF == false)
{

Job_Name_List=Job_Name_List.concat(rows("job_name")).concat("\n");
rows.MoveNext();
}
//alert(DB_Details);
rows.close();
}
catch (e) {
alert(e);
alert("Unable to Fetch Job Name List");
window.location.reload(1);
}

`
But it doesn't work with stored Proc. Can someone plz help me with the syntax for stored Proc. I need to execute stored_Porc(param1,param2). Both parameters are input variable. Am ok with either Javascript or VBScript.
 
Can someone please help me to run a Oracle stored procedure using OLEDB in JavaScript.

You can't.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.

Never mind this jesus character, stars had to die for me to live.
 
That's sad :(

not using vbscript also ? any other way to achieve it ?
 
Use an AJAX call to server side scripts is the only option for javascript.

vbscript, if running in a browser context is subject to similar constraints, and you will have to use the XMLHTTP object to make a server side request.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.

Never mind this jesus character, stars had to die for me to live.
 
Thanks for replying !
As it's a HTA tool, i don't have any server side concept.
However, after few more googling i found this and it worked. its a VBScript

ConnStr = "Provider=OraOLEDB.Oracle;" & _
"Data Source=(DESCRIPTION=" & _
"(ADDRESS=(PROTOCOL=TCP)" & _
"(HOST=ficoopdbp1-scan)(PORT=1521))" & _
"(CONNECT_DATA=(SERVICE_NAME=xyz)));User Id="&Repo_Username&";Password="&Rep_Password&";OLEDB.NET=True;"
Set connection = CreateObject("ADODB.Connection")
connection.connectionString=ConnStr
connection.open
connection.execute(exec proc('param1','param2'))
 
You may also be able to get it working with an ODBC connection string but it needs the odbc driver installed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top