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!

Errorr connecting to oracle 10g database.

Status
Not open for further replies.

dabiri

Technical User
Dec 8, 2014
33
0
0
US
Hi,
I have a simple vbscript that I had used to connect to an Oracle 10g database and execute simple queries. the database is on a server the vbscript was on my windows-XP machine.
Now the script has been moved to a windows 7-64 bit machine and I'm getting an error when I execute the script. Any suggestions would be greatly appreciated. Here's the script:


Code:
strCon = "Driver={Microsoft ODBC for Oracle}; " & _
        "CONNECTSTRING=(DESCRIPTION=" & _
        "(ADDRESS=(PROTOCOL=TCP)" & _
        "(HOST=xxx.xxx.xxx.xxx.)(PORT=1521))" & _
        "(CONNECT_DATA=(SERVICE_NAME=sid1))); uid=xxxxxx;pwd=xxxxxx;" 
     Set objConn = WScript.CreateObject("ADODB.Connection")    
     Set objRs = WScript.CreateObject("ADODB.Recordset")
     objConn.Open strCon
I'm getting the following error:
[highlight #CC0000]Error: [Microsoft][ODBC Driver Manager] Data source name not
found and no default driver specified.[/highlight]
 
How are you executing your script? You may need to use the 32-bit version of cscript.exe / wscript.exe, which are found in the %systemdrive%\Windows\SysWoW64 folder
 
I see you also posted here: thread1177-1741714. Don't cross-post please.
 
thanks for reply.
there's a script.exe in c:\windows\syswow64 folder - size 124kb
and also there's a script.exe in c:\windows\system32 folder - size 154kb
how would I tell windows which one to use?
and now, a script with connection to an access database is not working either.
any ideas would be appreciated.
 
here's the connection that i'm using for connecting to access database:
Code:
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet  = CreateObject("ADODB.Recordset")
objConnection.Open _
   "Provider=Microsoft.Jet.OLEDB.4.0; " & _
        "Data Source=C:\Documents and Settings\xxxxxxxx\Desktop\TCR_database\2005tcrs_Backup.mdb;" & _  
        "Jet OLEDB:System Database=Q:\public share\TCR\2005\2005tcr.mdw;User ID=xxxxxxxx;Password=xxxxxxxx;"
 
There is no "script.exe"... it's either cscript.exe (console only) or wscript.exe (with windows GUI). By default, the 64-bit versions are used on a 64-bit machine (from the c:\windows\system32 folder). The c:\windows\syswow64 folder has the 32-bit versions of each.

The manual way to see if the 32-bit version fixes your problem is to run cscript.exe or wscript.exe directly from the syswow64 folder. Open a command window in the folder that the vbs file is located in, and type either

C:\Windows\SYSWOW64\cscript.exe myscript.vbs

or

C:\Windows\SYSWOW64\wscript.exe myscript.vbs
 
wonderful job!
great!
I meant cscript.exe
the first one c:\Windows\SYSWOW64\cscript.exe myscript.vbs worked from the command prompt. thanks for the info.
but how would I run this from windows GUI? - Like double clicking on the .vbs icon?
thanks again.
 
access is running ok when I do it from the command prompt using: C:\Windows\SYSWOW64\cscript.exe myscript.vbs
but oracle is giving error: ORA-12560 TNS: PROTOCOL ADAPTOR ERROR
 
There might be better ways, but I usually just create a one-line batch file that executes the script using the 32-bit cscript.exe, and double-click that.
 
Thanks a bunch guitarzan.
I got oracle to work as well. I had to tweak control-panel\admin_tools\odbc and specify oracle SID in the "add" tab. the tnsnames.ora file is properly set up, but it needed to be defined in the odbc properties.
even though creating a bat file is an extra step, it should work ok. I just wish there was away to just double click the vbs icon and execute the script.
is there a way I can tell the "open with" tab what program to execute the script with?
is there a way to delete or rename "wscript" and just leave the one that works (cscript)?
if I delete or rename "wscript" will it be forced to execute cscript?
thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top