Skip to main content

Hey there,

I'm fairly new to using RUMBA. I have been looking over the web trying to find information about using the Rumba Script editor to connect to, and query and ODBC database. Is this possible? And would anyone be able to point me in the right direction for doing so?

Thanks!


#connection
#scriptEditor
#database
#ODBC
#Script
#question
#DB
#Rumba

Hey there,

I'm fairly new to using RUMBA. I have been looking over the web trying to find information about using the Rumba Script editor to connect to, and query and ODBC database. Is this possible? And would anyone be able to point me in the right direction for doing so?

Thanks!


#connection
#scriptEditor
#database
#ODBC
#Script
#question
#DB
#Rumba

Hi,
the answer is YES!
You can use Rumba Script to connect to a ODBC DB. See below a working  code snippet.

hope it helps

Option Explicit

 

'---- CursorTypeEnum Values ----

Const adOpenForwardOnly = 0

' Const adOpenKeyset = 1

' Const adOpenDynamic = 2

' Const adOpenStatic = 3

 

'---- LockTypeEnum Values ----

Const adLockReadOnly = 1

' Const adLockPessimistic = 2

' Const adLockOptimistic = 3

' Const adLockBatchOptimistic = 4

 

'---- CursorLocationEnum Values ----

' Const adUseServer = 2

Const adUseClient = 3

 

'---- ConnectModeEnum Values ----

' Const adModeUnknown = 0

Const adModeRead = 1

' Const adModeWrite = 2

' Const adModeReadWrite = 3

' Const adModeShareDenyRead = 4

' Const adModeShareDenyWrite = 8

' Const adModeShareExclusive = &Hc

' Const adModeShareDenyNone = &H10

' Const adModeRecursive = &H400000

 

Sub Main

 

      Dim Conn As Object

      Dim RS As Object

 

Set Conn = CreateObject("ADODB.Connection")                          ' Set DSN without UserId/PWD

      Conn.open "MySQL-R"                                                            ' DSN-NAME

 

 

Set RS = CreateObject("ADODB.Recordset")

      RS.CursorLocation = adUseClient

     RS.Source = "Select * from customers;"

     Set RS.ActiveConnection = Conn

     RS.CursorType = adOpenForwardOnly

     RS.LockType = adLockReadOnly

     RS.Open

           

      

      Do While Not RS.EOF

      Print RS.Fields.Item("ContactName").Value   

     RS.MoveNext

      Loop 

                

  

     

     RS.Close

Set RS = Nothing

 

     Conn.Close

Set Conn = Nothing

 

 

End Sub


Hey there,

I'm fairly new to using RUMBA. I have been looking over the web trying to find information about using the Rumba Script editor to connect to, and query and ODBC database. Is this possible? And would anyone be able to point me in the right direction for doing so?

Thanks!


#connection
#scriptEditor
#database
#ODBC
#Script
#question
#DB
#Rumba

Works like a charm! Thank you so much!!