This is in reference to the CONNECT Edition of MicroStation.
Just out of curiosity do you have any idea why vba can’t connect to the 11g oracle database?
This is the vba line of code that is erroring.
mdlDads.ADOConn.Open DB_PROPERTIES(INT_SELECTED_DB).STR_CONNECT
It works on all the other MicroStation installs. It is just this CONNECT Edition I am having issues with.
Here is a small sample that does not work in CONNECT Edition.
Sub Main() ' Modify this Constant as needed for your query. Const STR_SCHEMA As String = "ACBDB." Dim ADOConn As New ADODB.Connection Dim rsTest As New ADODB.Recordset Dim sSQL As String Dim i As Integer Dim s As String ' Modify this query to find data in your test database. sSQL = "select * from " & STR_SCHEMA & "acb_sp where terrain_type = 'TOWER' and DESCRIPTION = 'GF'" ' Modify this text to connect to your oracle database. s = "Provider=OraOLEDB.Oracle;Data Source=YOUR SOURCE;User ID=YOURUSERID;Password=YOURPASSWORD;FEN=T;FRC=5;FDL=5;" Set ADOConn = Nothing ADOConn.Open s Call rsTest.Open(sSQL, ADOConn, adOpenStatic, adLockReadOnly) If rsTest.RecordCount > 0 Then rsTest.MoveFirst For i = 0 To 1 ' Modify the field numbers to match your table. Debug.Print rsTest.Fields(1).Name & " - " & rsTest.Fields(1).Value Debug.Print rsTest.Fields(2).Name & " - " & rsTest.Fields(2).Value Debug.Print " " rsTest.MoveNext Next End IfEnd Sub
Here is info about what I have tried and the software installed.
I am not getting any help from the internet or anyone with this issue.
I have attached a small vba app that will connect to an oracle database and print a couple of lines in the Immediate window.
I made notes in the code of what changes you may have to do to get it to work for you.
I am getting the following error.
Run-time error 3706
Provider cannot be found. It may not be properly installed.
I have been looking and reading all sorts of stuff on the internet and nothing about the issue I am having with CONNECT Edition shows up.
I have been trying to get this to work for weeks.
Please help me.
This works on the following.
Oracle 11g
MicroStation SELECTseries 4 Version 08.11.09.829
Windows 10 Version 1709
The computer I am trying on has the following information
MicroStation CONNECT Edition Update 13 Version 10.13.01.01
Hi,
civerson said:This is in reference to the CONNECT Edition of MicroStation.
I recommend to follow the forum best practices. Things like standardized subject format helps to share important information without extra information.
civerson said:why vba can’t connect to the 11g oracle database?
As you wrote, it's not about MicroStation, but about referenced VBA library. Maybe StackOverflow is better place where to ask?
civerson said:It works on all the other MicroStation installs.
By "all other" you mean V8i installations? The main difference is that V8i is 32bit application, so VBA references 32bit libraries (ocx, dll...). MicroStation CONNECT Edition is 64bit application, so also referenced ADO has to be 64bit and I guess the chain has to be complete, so also Oracle driver has to be 64bit.
Regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Does anyone know if CONNECT Edition of MicroStation has to have 64 bit oracle or will 32 bit work ok for vba connection?
Hi Chris,
MicroStation CONNECT Edition and MicroStation/Microsoft VBA (both 64-bit apps) require (per Microsoft 64-bit VBA recommendations) an Appropriate Supported Microsoft 64-bit client connection type and 64-bit Data Source Connection (or odbcad32.exe) to be created. MicroStation CONNECT Database Support lists support for Oracle 11 64-bit connections.Note:
If using Microsoft Office apps that need to interact with MicroStation CONNECT; 64-bit Office would be best.
See Also:
HTH,Bob
Hi Bob,
None of the examples you posted show the vba code to connect to oracle 11g or 12c. I am not much of a DB person so I need oracle examples. Are there any vba apps in CONNECT Edition accessing an oracle DB that I can look at?
civerson said:None of the examples you posted show the vba code to connect to oracle 11g or 12c.
In my opinion there is no "special code for Oracle". Using generic DB interfaces and libraries like ODBC, OLE DN, ADO etc. typically differ only in the connection string, nothing else. But crucial is to have correct DB libraries and drivers (as mentioned by both me and Bob already) installed.
Did you try to search Internet? When I use e.g. "VBA 64bit connect to oracle" phrase, I received some interesting links. None of them seem is giving clear answer, but at least they represent discussion and advises to similar topic(s).
Does this look right for the Declare statements in the 64 bit vba app?
I added the LongLong for the Long parameters and LongPtr for the Long returned.
Private Declare PtrSafe Function GetPrinter Lib "winspool.drv" _ Alias "GetPrinterA" (ByVal hPrinter As Long, _ ByVal Level As LongLong, pPrinter As Any, _ ByVal cbBuf As LongLong, pcbNeeded As LongLong) As LongPtr
For the ADOConn.Open line above it looks like this.
mdlDads.ADOConn.Open Provider=OraOLEDB.Oracle;Data Source=DANDS;User ID=DADSUSER;Password=DADS07;FEN=T;FRC=5;FDL=5;
civerson said:Do you have any idea why vba can’t connect to the 11g oracle database?
Everything must be 64-bit when using MicroStation CONNECT, including the intervening OLE-DB or ODBMS component.
civerson said:mdlDads.ADOConn
What is mdlDads? Does that use Microsoft ADO to connect to the DB?
Yours isn't necessarily a MicroStation problem — here's someone trying to connect to Oracle from Excel VBA.
Regards, Jon Summers LA Solutions
Unfortunately I do not have access to an Oracle database instance to provide a (generic non-Bentley) copy/paste sample Oracle database connection string.
However Oracle OLEDB online docs and many posts/guides can be found on the internet using a search like: create+oracle+oledb+connection+file; where the top two results look rather promising/helpful.
For app testing, development and deploying (having proper ACLs) consider; "Building and Saving Connection Strings Using the Data Link Properties Dialog Box". Following this approach allows you to test and create properly formed ADODB connection strings w/o errors and optionally save them in UDL file extensions; making it easy to deploy an app w/o configuring connections or hard-coding connection strings in your apps.
civerson said:Does this look right for the Declare statements in the 64 bit vba app?
Don't hijack your own thread! This is a different subject to your original question, and it's unrelated to MicroStation; rather, it's a Microsoft technology question.