VBScript Oracle驱动程序版本要求

时间:2014-04-08 13:53:57

标签: vbscript windows-7-x64

我遇到与Error using Microsoft Access Driver in Windows 7

相同的问题

我有:       Windows 7 64位,       Oracle-OraClient 11g Home 2 32位驱动程序,以及      Office 2013 32位。

在这个版本中,即使我已经从SysWOW64目录中添加了odbcad32.exe上的DSN并确保使用SysWow64中的wscript.exe打开了vbscripts,我仍然会收到ODBC驱动程序管理器错误。

运行相同的vbscript但Access 2013无法识别Oracle驱动程序       Windows 7 = 64位,       Oracle-OraClient 11g Home 2 = 64位驱动程序和      Office 2013 = 32位。

Option Explicit 
Dim i, cnt, r, c, nc, v, vname, vinvoice, vamount, vdate, vlowdate, vin, vpo, vcompany 
Dim ofs, oFolder, oFiles, sFile, sFileName, sExtension 
Dim iSqlDetail, vRawISql , vsqldetail 
Dim oExcel, oWorkbook, oWorksheet 
Dim oAdo, sSql, oRs, aRs, oTs 
Dim vPath , sPath , sOutput 
Set oExcel = CreateObject("Excel.Application") 
oExcel.Visible = True 
Set oAdo = CreateObject("ADODB.Connection")      
oAdo.ConnectionString= "User ID=uname;Password=pwd;DSN=MYDSN" 
oAdo.Open 
Set ofs = CreateObject("Scripting.FileSystemObject") 
Set ofolder = ofs.GetFolder(".") 

1 个答案:

答案 0 :(得分:0)

这是从DB获取数据并将其存储在剪贴板中的Java代码 - 因为我的记录集永远不会很大,所以我可以侥幸逃脱: - )

Java代码 - 将其编译为classfile

import java.sql.*;
import java.awt.datatransfer.*;
import java.awt.Toolkit;
import java.io.*;

public class BookNameHelper {
    public static void main(String[] args) {
        Connection connection = null;
        try {
            connection = DriverManager.getConnection("jdbc:oracle:thin:@ORAD01:5500:CALT3", "schemaname","password");
        } catch (SQLException e) {
            e.printStackTrace();
            return;
        }

        if (connection != null) {
            try {
                Statement stmt = connection.createStatement();
                String selectstr = "select bookname from bookstore where publisher="+"'"+args[0]+"'";
                ResultSet rs = stmt.executeQuery(selectstr);
                while (rs.next()) {
                    String BookName = rs.getString("bookname");
                    Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard();
                    StringSelection testData;
                    testData = new StringSelection(traderName);
                    clip.setContents(testData, testData);
                    System.out.println(BookName);
                }
                connection.close();
            } catch (Exception e)
            {
                e.printStackTrace();
            }
        } else {
        }
    }
}

VBS - 然后您可以使用VBScript从剪贴板读取数据集并将其存储在变量中......如下所示

Set oHtml = CreateObject("htmlfile")
SuffixText = oHtml.ParentWindow.ClipboardData.GetData("text")
Set oHtml = Nothing