0

Hi Please help me with the following. I used the below VB code to upload a text file to my oracle database.When i run my script i have the error message "Class not defined ADODB"

Set Obj_DBConn = New ADODB.Connection
Set cat = New ADOX.Catalog



Obj_DBConn.ConnectionString ="Driver={Microsoft ODBC for Oracle}; " & _
                             "CONNECTSTRING=(DESCRIPTION=" & _
                             "(ADDRESS=(PROTOCOL=TCP)" & _
                             "(HOST=##test##)(PORT=##test##))" & _
                             "(CONNECT_DATA=(SERVICE_NAME=##test##))); " & _
                             "uid=test;pwd=test;"


Obj_DBConn.Open Database_Path


Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")




Set f = Nothing

Set f = fso.OpenTextFile("C:\Documents and Settings\test.txt", ForReading, True)

For i = 1 To 10000

v_Line_String = f.ReadLine


v_Output_Each_part = Split(v_Line_String,";",-1,1)

v_Col_A = v_Output_Each_part(0)
v_Col_B = v_Output_Each_part(1)
v_Col_C = v_Output_Each_part(2)



Obj_DBConn.Execute "INSERT INTO  test_me (ID_Q, NAME, ROLLNO) VALUES ('"       & v_Output_Each_part(0) & "','" & v_Output_Each_part(1) & "','" & v_Output_Each_part(2) & "')"



Next

Please provide ur insights Thanks in advance

1 Answer 1

1

Your

Set Obj_DBConn = New ADODB.Connection

is VBA, not VBScript. Use

Set Obj_DBConn = CreateObject("ADODB.Connection")

to get this line passed the interpreter.

If you promise to delete the evil "On Error Resume Next", you may obtain further inspiration from here.

Update:

If you google for something like "80004005 odbc oracle" you'll find this trouble shooter with detailed step by step instructions to deal with connectivity problems. Next stop probably should be connectionstrings.com.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks you, my error prompt doesnt stop ther.. i have the following error prompt CODE:80004005 ERROR:[Microsoft][ODBC driver for oracle][Oracle] Source:Microsoft OLE DB Provider for ODBC Drivers

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.