OLE DB Driver for SQL Server

Questions about Wine on Linux
Post Reply
josephmore
Newbie
Newbie
Posts: 2
Joined: Sat Sep 12, 2020 11:17 pm

OLE DB Driver for SQL Server

Post by josephmore » Sun Sep 13, 2020 12:36 am

I am trying to connect to a local instance of MSSQL 2019 in a VB6 application running on Wine using MSOLEDBSQL as a provider.
However after installing vb6run mdac_28 overide_mdac and of course msoledbsql.msi in a 32-bit prefix I get the following error:

Code: Select all

000d:err:menubuilder:init_xdg error looking up the desktop directory
0009:err:ole:CoGetClassObject class {6c736db1-bd94-11d0-8a23-00aa00b58e10} not registered
0009:err:ole:CoGetClassObject no class object {6c736db1-bd94-11d0-8a23-00aa00b58e10} could be created for context 0x1
0009:err:ole:apartment_getclassobject DllGetClassObject returned error 0x80004005 for dll L"C:\\windows\\system32\\msoledbsql.dll"
0009:err:ole:create_server class {5a23de84-1d7b-4a16-8ded-b29c09cb648d} not registered
0009:err:ole:CoGetClassObject no class object {5a23de84-1d7b-4a16-8ded-b29c09cb648d} could be created for context 0x17
The VB6 code that I am trying to execute:

Code: Select all

Dim conn As Object
Dim comm As Object

On Error GoTo ErrorH

Set conn = CreateObject("ADODB.Connection") 
Set comm = CreateObject("ADODB.Command")
Set rs = CreateObject("ADODB.Recordset")

Dim provider As String
Dim server As String
Dim port As String
Dim database As String
Dim uid As String
Dim pwd As String

provider = "MSOLEDBSQL"
server = "127.0.0.1"
port = "1433"
database = "WebComexUsuarios"
uid = "User"
pwd = "Password"

conn.open "Provider=" & provider & ";" _
        & "Data Source=" & server & "," & port & ";" _
        & "Network Library=DBMSSOCN;" _
        & "Encrypt=No;" _
        & "TrustServerCertificate=no;" _
        & "Initial Catalog=" & database & ";" _
        & "User ID=" & uid & ";" _
        & "Password=" & pwd & ";"

comm.ActiveConnection = conn
comm.CommandType = 1 'adCmdText
comm.CommandText = "SELECT @@VERSION AS Version"
rs.CursorLocation = 3 'adUseClient
rs.open comm, , 0, 1 'adOpenForwardOnly, adLockReadOnly

MsgBox rs("Version")

rs.Close
conn.Close

GoTo ExitSub
ErrorH:
MsgBox Err.Number & " " & Err.Description
ExitSub:
Set rs = Nothing
Set comm = Nothing
Set conn = Nothing
OS: Ubuntu 2020 Server, Wine: 5.0

spoon0042
Level 5
Level 5
Posts: 361
Joined: Thu Dec 24, 2009 11:00 am

Re: OLE DB Driver for SQL Server

Post by spoon0042 » Sun Sep 13, 2020 7:55 pm

Can you try adding an override for msado15.dll (native, builtin)? There's an open issue with winetricks and it's possible that's the problem.

josephmore
Newbie
Newbie
Posts: 2
Joined: Sat Sep 12, 2020 11:17 pm

Re: OLE DB Driver for SQL Server

Post by josephmore » Sun Sep 13, 2020 10:26 pm

spoon0042 wrote:
Sun Sep 13, 2020 7:55 pm
Can you try adding an override for msado15.dll (native, builtin)? There's an open issue with winetricks and it's possible that's the problem.
overide_mdac actually overrides msado15.dll, without it the ADO objects simply could not be used.

Post Reply