Ошибка 2147467259 mysql

Помогите справится с проблемой!

Купил я один сайт  написаный на ASP. Он поддерживает 3 БД(MSAccess,MSSQL,MySQL). По умолчанию все настроено на Базу Данных MS ACCESS, но так как мне нужно было переделать его на 3 языка (English, Russian, Latvian), то сталкнулся с проблемой кодировки на UTF-8. Решил перейти на MySQL. В мануале написанно:

MySQL Database Configuration.
Create a new database at web hosting Control Panel (refer to hosting documentation for procedures). In config/config.asp configuration file find ‘*** MySQL DATABASE *** section and change variables for MySQL server name, User ID, Password and Database Name.
If for instance you have server name — mysql1.myhosting.net, database name – xx_database, User ID – xx_user and password – cryptic_word, then configuration variables would look like:
‘# MySQL SERVER NAME (PROVIDED BY YOUR HOST)
MySQLServer = «mysql1.myhosting.net»
‘# MySQL USER ID (AUTHENTICATION)
MySQLUser = «xx_user»
‘# MySQL PASSWORD (AUTHENTICATION)
MySQLPassword = «cryptic_word»
‘# MySQL DATABASE NAME
MySQLDBName = «xx_database» Save config.asp and transfer it to the web server. Continue with the next step in “New Setup Instructions” (previous chapter).

посавил я MySQL последную версию…но не фига в ней неразбираюсь. Как то создал пустую базу xx_database.

зделал я так:

‘# MySQL SERVER NAME (PROVIDED BY YOUR HOST)
MySQLServer = «127.0.0.1»
‘# MySQL USER ID (AUTHENTICATION)
MySQLUser = «xx_user»
‘# MySQL PASSWORD (AUTHENTICATION)
MySQLPassword = «cryptic_word»
‘# MySQL DATABASE NAME
MySQLDBName = «xx_database»

дальше …как я понимаю…я должен указать путь в config.asp на созданную БД
но проблема такая что я не знаю как ето сделать….и где вообще эта БД находится???

вот кусок из config.asp

        dbFolder = «db/»
        upload = «cl_upload/»
        bnrLocation = «banners/»
        ad_cache = «ads/»
        logo = «img/logo.gif»

MySQL ставил все по умолчанию, по идее БД должна наверное находится тут:

C:/Program Files/MySQL/MySQL Server 5.0/Data/xx_database

но если я пишу в config.asp так:

                       dbFolder = «C:/Program Files/MySQL/MySQL Server 5.0/Data/xx_database/»
        upload = «cl_upload/»
        bnrLocation = «banners/»
        ad_cache = «ads/»
        logo = «img/logo.gif»
то мне выдает такую ошибку:

-2147467259 [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified Current Database Provider Connection String is:

strConn = «Driver={MySQL ODBC 3.51 Driver};server=127.0.0.1;uid=xx_user;database=xx_database;»
Подскажите пожалуста что делать???

I want to create a database in the installation process using WiX 3.6. I followed many tutorials, but I think there is something I am doing wrong.

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
     xmlns:sql="http://schemas.microsoft.com/wix/SqlExtension">

    <Product Id="{A704CA9E-2833-4276-A8A8-148F1047332F}" Name="DbInstallerTest" Language="1033" Version="1.0.0.0" Manufacturer="Microsoft" UpgradeCode="2de42bd8-acc2-48bf-b3c6-09745d3a2ea4">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
        <MediaTemplate />

        <Feature Id="ProductFeature" Title="DbInstallerTest" Level="1">
            <ComponentGroupRef Id="ProductComponents" />
        </Feature>
    </Product>

    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLFOLDER" Name="DbInstallerTest" />
            </Directory>
        </Directory>
    </Fragment>

    <Fragment>
        <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">

            <Component Id="CMPDbInsatller"
                       Guid="{1749E57D-9CE4-42F8-924C-2A2E368B51E4}">
                <CreateFolder Directory="INSTALLFOLDER"/>
                <util:User Id="SqlUser"
                           Name="sa"
                           Password="Abc123@"/>
            </Component>
            <Component Id="cmp2"
                       Guid="{C3596364-61A0-4628-9153-1BA11DB4B778}">
                <CreateFolder Directory="INSTALLFOLDER"/>
                <sql:SqlDatabase Id="Id_db"
                                 Database="TestDatabase1"
                                 Server="(local)SQLExpress"
                                 CreateOnInstall="yes"
                                 User="SqlUser"
                                 DropOnUninstall="yes">
                </sql:SqlDatabase>
            </Component>
        </ComponentGroup>
    </Fragment>
</Wix>

The above code gives the following error.

Error -2147467259: failed to create SQL database: TestDatabase1. error detail: Unknown error.

Here is the log content,

=== Logging started: 2/18/2013  11:00:59 ===
Action 11:00:59: INSTALL.
Action start 11:00:59: INSTALL.
Action 11:00:59: FindRelatedProducts. Searching for related applications
Action start 11:00:59: FindRelatedProducts.
Action ended 11:00:59: FindRelatedProducts. Return value 1.
Action 11:00:59: LaunchConditions. Evaluating launch conditions
Action start 11:00:59: LaunchConditions.
Action ended 11:00:59: LaunchConditions. Return value 1.
Action 11:00:59: ValidateProductID.
Action start 11:00:59: ValidateProductID.
Action ended 11:00:59: ValidateProductID. Return value 1.
Action 11:00:59: CostInitialize. Computing space requirements
Action start 11:00:59: CostInitialize.
Action ended 11:00:59: CostInitialize. Return value 1.
Action 11:00:59: FileCost. Computing space requirements
Action start 11:00:59: FileCost.
Action ended 11:00:59: FileCost. Return value 1.
Action 11:00:59: CostFinalize. Computing space requirements
Action start 11:00:59: CostFinalize.
Action ended 11:00:59: CostFinalize. Return value 1.
Action 11:00:59: MigrateFeatureStates. Migrating feature states from related applications
Action start 11:00:59: MigrateFeatureStates.
Action ended 11:00:59: MigrateFeatureStates. Return value 0.
Action 11:00:59: ExecuteAction.
Action start 11:00:59: ExecuteAction.
Action start 11:01:01: INSTALL.
Action start 11:01:01: FindRelatedProducts.
Action ended 11:01:01: FindRelatedProducts. Return value 0.
Action start 11:01:01: LaunchConditions.
Action ended 11:01:01: LaunchConditions. Return value 1.
Action start 11:01:01: ValidateProductID.
Action ended 11:01:01: ValidateProductID. Return value 1.
Action start 11:01:01: CostInitialize.
Action ended 11:01:01: CostInitialize. Return value 1.
Action start 11:01:01: FileCost.
Action ended 11:01:01: FileCost. Return value 1.
Action start 11:01:01: CostFinalize.
Action ended 11:01:01: CostFinalize. Return value 1.
Action start 11:01:01: MigrateFeatureStates.
Action ended 11:01:01: MigrateFeatureStates. Return value 0.
Action start 11:01:01: InstallValidate.
Action ended 11:01:01: InstallValidate. Return value 1.
Action start 11:01:01: RemoveExistingProducts.
Action ended 11:01:01: RemoveExistingProducts. Return value 1.
Action start 11:01:01: InstallInitialize.
Action ended 11:01:01: InstallInitialize. Return value 1.
Action start 11:01:01: ProcessComponents.
Action ended 11:01:01: ProcessComponents. Return value 1.
Action start 11:01:01: UnpublishFeatures.
Action ended 11:01:01: UnpublishFeatures. Return value 1.
Action start 11:01:01: UninstallSqlData.
Action ended 11:01:02: UninstallSqlData. Return value 1.
Action start 11:01:02: RemoveFiles.
Action ended 11:01:02: RemoveFiles. Return value 0.
Action start 11:01:02: RemoveFolders.
Action ended 11:01:02: RemoveFolders. Return value 1.
Action start 11:01:02: CreateFolders.
Action ended 11:01:02: CreateFolders. Return value 1.
Action start 11:01:02: ConfigureUsers.
Action start 11:01:02: CreateUserRollback.
Action ended 11:01:02: CreateUserRollback. Return value 1.
Action start 11:01:02: CreateUser.
Action ended 11:01:02: CreateUser. Return value 1.
Action ended 11:01:02: ConfigureUsers. Return value 1.
Action start 11:01:02: InstallFiles.
Action ended 11:01:02: InstallFiles. Return value 1.
Action start 11:01:02: InstallSqlData.
Action start 11:01:19: CreateDatabase.
Action ended 11:01:19: CreateDatabase. Return value 1.
Action ended 11:01:19: InstallSqlData. Return value 1.
Action start 11:01:19: RegisterUser.
Action ended 11:01:19: RegisterUser. Return value 1.
Action start 11:01:19: RegisterProduct.
Action ended 11:01:19: RegisterProduct. Return value 1.
Action start 11:01:19: PublishFeatures.
Action ended 11:01:19: PublishFeatures. Return value 1.
Action start 11:01:19: PublishProduct.
Action ended 11:01:19: PublishProduct. Return value 1.
Action start 11:01:19: InstallFinalize.
CreateDatabase:  Error 0x80004005: failed to create to database: 'TestDatabase1', error:

unknown error
Error 26201. Error -2147467259: failed to create SQL database: TestDatabase1, error detail:

unknown error.
MSI (s) (94!44) [11:01:47:973]: Product: DbInstallerTest -- Error 26201. Error -2147467259:

failed to create SQL database: TestDatabase1, error detail: unknown error.

CustomAction CreateDatabase returned actual error code 1603 (note this may not be 100%

accurate if translation happened inside sandbox)
Action ended 11:01:47: InstallFinalize. Return value 3.
Action ended 11:01:48: INSTALL. Return value 3.
Action ended 11:01:48: ExecuteAction. Return value 3.
Action ended 11:01:48: INSTALL. Return value 3.
=== Logging stopped: 2/18/2013  11:01:48 ===
MSI (c) (C0:94) [11:01:48:208]: Product: DbInstallerTest -- Installation failed.

MSI (c) (C0:94) [11:01:48:209]: Windows Installer installed the product. Product Name:

DbInstallerTest. Product Version: 1.0.0.0. Product Language: 1033. Manufacturer: Microsoft.

Installation success or error status: 1603.

What am I doing wrong here?

Peter Mortensen's user avatar

asked Feb 18, 2013 at 5:43

Isuru Gunawardana's user avatar

We chased this error around for a week before finally resolving it by going into the SQL Server Configuration Manager → SQL Server Network Configuration → Protocols for MSSQLSERVER (for us, the default instance) → Enabling Named Pipes and TCP/IP protocols.

Peter Mortensen's user avatar

answered Mar 31, 2014 at 18:22

sunfallSeraph's user avatar

I was also facing this exact issue, and I browsed a lot of forums to get that solved. This was the only thing which worked for me. On my computer, SQL Server Express Edition database creation failed with
-2147467259: failed to create SQL database:

After days of hacking I finally found the solution! All you need to do
is use .sqlexpress instead of localhostsqlexpress or
127.0.0.1sqlexpress in your connection string. I think (and I might be terribly wrong here) when you use .sqlexpress in connection string
installer uses Shared Memory instead of Named Pipes or TCP/IP.

Source: Solution to -2147467259: failed to create SQL database

Peter Mortensen's user avatar

answered Apr 24, 2014 at 15:43

Soman Dubey's user avatar

Soman DubeySoman Dubey

3,7994 gold badges22 silver badges31 bronze badges

Err 26201 is more useful. You should also see more information in the event logs.

Your code indicates that you are using mixed mode on the SQL instance and authenticating as a SQL login. This indicates that the problem is likely that your SQL service account doesn’t have permissions to create the MDF and LDF files in the default locations.

See this thread for more info:

Error 26201. Error -2147467259: failed to create SQL database

answered Feb 18, 2013 at 14:34

Christopher Painter's user avatar

So I am also getting an error in my WiX installer logs also, however slightly different.

Environment:

  • WebServer = Windows 2008 R2
  • SQLServer = Windows 2008 32-bit with SQL Server 2008 R2 Standard
  • Mixed Mode Authentication
  • Default SQL Instance

Error:

ExecuteSqlStrings: Entering ExecuteSqlStrings in
C:WindowsInstallerMSI1EC7.tmp, version 3.6.3303.0

ExecuteSqlStrings: Error 0x80004005: failed to connect to database:
‘DatabaseNameBla’

Error 26203. Failed to connect to SQL database.
(-2147467259 DatabaseNameBla ) MSI (s) (20!30) [10:16:32:225]:
Product: Bla Services — Error 26203. Failed to connect to SQL
database. (-2147467259 DatabaseNameBla )

Research:

  • Instance DB seems to have only 1.6 GB left on the hard drive. << this might be bad…
  • My user is sysadmin
  • Access Through SQL Management Tools has no problems with the same user.
  • SLQ Logs have nothing in them to assist with the error. Just noise.

My Solution:

  • VM has a D drive with 50 GB free
  • New Database Instance on D Drive
  • New Instance Set to Mixed Mode
  • Reinstalled. Success!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Summary:

So after hours of trying to figure out what the deal was. In the instance of this error, it was related to the hard drive free space size. Since the SQL Server was in production we were unable to expand the C drive to see if that fixed the default instance.

Community's user avatar

answered Apr 11, 2014 at 15:48

Omzig's user avatar

OmzigOmzig

8611 gold badge12 silver badges20 bronze badges

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
Option Compare Database
Option Explicit
 
'--------------------------------------------------------------------------
' Module    : modLink_MySQL_ADOX
' Author    : es
' Date      : 24.07.2017
' Purpose   : Переподключение таблиц MySQL без DSN
'--------------------------------------------------------------------------
' - Требует установки MySQL ODBC ODBC MySQL драйвера
'--------------------------------------------------------------------------
'Требуются ссылки на:
'    Microsoft ADO Ext. for DDL and Security. (Version 2.1 or higher)
'    Microsoft ActiveX Data Objects Library. (Version 2.1 or higher)
'--------------------------------------------------------------------------
 
 
Public ConnStr$
Private cat As ADOX.Catalog
Private tbl As ADOX.Table
Private AConnectionString_ADOX As String
Private i%, s$
 
Public Sub StartReLink_MySQL_ADOX(Optional bDelOnly As Boolean)
'Собственно процедура подключения (основная)
 
Dim arrTables() As Variant
Dim arrTables_1() As Variant
 
'--------------------------------------------------------------------------
On Error GoTo StartReLink_MySQL_ADOX_Err
    DoCmd.Hourglass True 'Показать часики
 
 
'Массив табличек:
    arrTables = Array("Amper", "Baza", "Baza_Pitatel", "Cat_Empl", "Chet", "Chet_Kompl", "Cklad", "Vid_Nomenkl_ERP", "Klaccif_Nomenkl_ERP", "Uroven_Ctrykt_ERP", _
        "Cklad_Dvig_Izd", "Cod_Empl", "Cotrydnik", "Cpecifikaciy", "Cpecifikaciy_Pza1", "Cpr_Nomenkl_ERP", "Ctryktyra_Izdely_ERP", _
        "Cpocob_Per_Zak", "Cpr_Dorabotok", "Ctr_Izd_Modyl", "Ctr_Izd_Ocnov", "Ctrana", "Licev_Nakl_Izdelie", "Licev_Nakl_Plan_Vipycka_Izd", "Licev_Nakl_Prixod", "Licev_Nakl_Racxod", "Izdelie_Licev", _
        "Ctryktyra_Izdely", "Cvoictva_Znach", "Cvoictvo_Detali", "Dolznoct", "Dop_Zamena", "Operacii_ERP", "Izdely_Operacii_ERP", _
        "Edinicy_Izmereny", "Forma_Cobctv", "Funk_Claim", "Funk_Otvetctv_Za_Vip", _
        "Funk_Pol_Inform", "Funk_Procecc", "Funk_Structure", "Funk_View", "Funk_Ychactv_V_Vip", _
        "Gorod", "Grup_Empl", "Gryp_Clozn_Rem", "Icpolnenie", "Identifikator_Izd", _
        "Invent_Cklad", "Izdelie", "Izdelie_copy", "Izdelie_Komplekty", "Izd_Preemnik", "Izdelie_Modifikaciy", "Izdelie_TO", _
        "Izdely_Gryp", "Izv_Cogl", "Izv_Cogl_Jyrnal_Cob", "Izv_Ctatyc", "Izv_Formylirovki", _
        "Izv_Izdelie", "Izv_Jyrnal_Cob", "Izv_Koment", "Izv_Koment_Jyrnal_Cob", "Izv_Modul", "Izv_Kritichnoct", _
        "Izv_Vid_Cogl", "Izveshenie", "Level_Competence", "Mecto_Xraneniy", "Modifikaciy", _
        "Modyl", "Name_Funk", "Name_Group", "NameFunk", "Necootvetctv", "Oboryd_TO", _
        "Oborydovanie", "Ogr_Cpicok", "ooDecim_Nomer", "ooGryppa_Izd", "ooKlacc_Izd", _
        "ooPodgryppa_Izd", "ooPodklacc_Izd", "ooPor_Regictr_Nomer", "ooVid_Izd", "Operaciy_Cklad", _
        "Operaciy_Oboryd", "Operaciy_Texnol", "Operaciy_Vipol", "Opicanie_Cvoictv", "Org_Ctrykt", _
        "Organizat_Role", "Otdel", "Pitatel", "Bab_Fid_Yct", "Fider", "Fider_Kompon_Progr", "Fider_Pit", _
        "Racpolozenie", "Pitatel_Partia", "Pitatel_Xarakter", "Plata_Defekt", "Poctavchik", _
        "Porycheniy", "Prichina_Vozvr_Iz_OTK", "Privyzka_Coctava", "Process", "Process_A", "Progr", "TP_Mex", "TP_Mex_Vibor", "TP_Mex_Vipoln", "Partiy_Mex", "Peremesh_Mex", _
        "Proizvod", "R_RA", "Rabota_Robotov", "Requ_For_Specialty", "Site", "Sites_1", "Texprocecc", _
        "Tip_Dokym", "Tip_Operaciy", "To_I_R", "To_I_R_Prichina", "To_I_R_Cherez_Cklad", "To_I_R_Cherez_Cklad_copy", "Obmenniy_Fond", "To_Izd", "Imiy_Shkafa", "To_Izd_Cpicok_Rab", _
        "To_Obor_Cpicok_Rab", "Verciy_PO", "Verciy_Po_Aktualn", "Vid_Rabot", "Vid_Rabot_To", _
        "Vizm_Neicpr_Napominal", "Vozm_Neicpr_Priborov", "Volt", "Vozvrat_Iz_Otk", "Vxod_Kontrol", "Zakaz", "Zakazchik", "Bx_Kontr_Nomenkl", "Bx_Kontr_Zyrnal", "Cootvetctvie", _
        "Zip", "Zip_Cklad", "Zip_Cklad_Racxod", "Zip_Dvigenie", "Zip_Imia", "Zip_Mex_Cbor", "Klacter_Remonta", "Klacter_Remonta_Org", _
        "Zip_Partiy", "Zip_Partiy_Brem_Nakleika", "Zip_Poctavshik", "Zip_Vid", "Zip_Ynikaln", "Izdelie_Verciy_PO", "Dokyment", _
        "Imenovanie", "Klassif_Schtrix", "Texprocecc_Izd", "Klaccif_Nomer_PO", "Reviziy_PO", "Tip_Failov_PO", "Remont", "Kod_1_Panel_IHM", "Kod_2_Panel_IHM", "Kod_3_Panel_IHM", "Kod_4_Panel_IHM", "Kod_Coctav_Modyley_VV", "Kod_Tip_Mezonina_Cviazi", "Kod_Tip_Modyl_Proceccora", "Kod_Tip_Razmeri_Korpyca", "Kod_Vercii_PO", "Ciriyc_New", "Ciriyc_New_Racborka")
    'arrTables = Array("Uroven_Ctrykt_ERP", "Cpr_Nomenkl_ERP", "Ctryktyra_Izdely_ERP", "Operacii_ERP", "Izdely_Operacii_ERP")
 
'--------------------------------------------------------------------------
'Предварительный промсмотр (если нужно):
    Debug.Print String(74, "-")
    For i = LBound(arrTables) To UBound(arrTables)
        s = arrTables(i)
        Debug.Print Format(i + 1, "000"); ".  " & s
    Next i
    Debug.Print String(74, "-")
    Debug.Print "Всего: " & Format(i, "00") & " таблиц " & Now
    Debug.Print String(74, "-")
'--------------------------------------------------------------------------
    'GoTo StartReLink_MySQL_ADOX_Bye
    
'Запуск
    'ReLinkTables_ADOX arrTables, "00_", bDelOnly    ' Полное переподключение
    ReLinkTables_ADOX arrTables, , bDelOnly    ' Полное пере-подключение
 
StartReLink_MySQL_ADOX_Bye:
    DoCmd.Hourglass False 'Вернуть нормальный курсор
    Exit Sub
 
StartReLink_MySQL_ADOX_Err:
    MsgBox "Error: " & Err.Number & vbCrLf & Err.Description & vbCrLf & _
    "in procedure: StartReLink_MySQL_ADOX in module: modLink_MySQL_ADOX", _
    vbCritical, "Error in Application!": Err.Clear
    Resume StartReLink_MySQL_ADOX_Bye
        
End Sub
 
Private Sub ReLinkTables_ADOX(arrTables() As Variant, Optional sTblLocalPrefix$ = "", Optional bDelOnly As Boolean)
' Вспомогательная -  Переподключение таблиц по массиву
'--------------------------------------------------------------------------
'Аргументы:
'   arrTables()      = Массив табличек
'   sTblLocalPrefix  = Локальный префикс названий
'   bDelONly         = Только удалить и не подключать если = True (-1)
'--------------------------------------------------------------------------
Dim sTblName$
Dim sDriver As String
Dim sServerAdr As String
Dim sCharset As String
Dim sServPort As String
Dim sDbName As String
Dim sUser As String
Dim sPassWord As String
Dim l&
 
On Error GoTo ReLinkTables_ADOX_Err
 
    
    If Dir("C:Program FilesMySQLConnector ODBC 3.51", vbDirectory) <> "" Then
        sDriver = "{MySQL ODBC 3.51 Driver}" 'Папка Connector ODBC 3.51 существует. Драйвер для 32 разрядной операционной системы(для устаревших компьютеров- где дополниетльные программы (требующиеся для работы этого драйвера) плохо или не ставятся вовобще)
    ElseIf Dir("C:Program FilesMySQLConnector ODBC 5.3", vbDirectory) <> "" Then
        sDriver = "{MySQL ODBC 5.3 Unicode Driver}" 'Драйвер для 32 или драйвер для 64 разрядного MS Office - в зависимости , что установлено. Имя папки одинаковое.
    Else
        MsgBox "Нет драйвера ODBC для работы с  MySQL"
        Exit Sub
    End If
    
    'sServerAdr = "localhost"
    sServerAdr = "managementdb.rza.ru"   ' Адрес (Имя) сервера
    sServPort = "3306"         ' Порт соединения = 3306 (Обычно так и есть)
    sDbName = "management" ' Название базы
    sUser = "management"             ' Имя пользователя
    sPassWord = "123456"    ' Пароль
 
s = ""
'Создаю строку подключения:
 ConnStr = ";DRIVER=" & sDriver & _
        ";SERVER=" & sServerAdr & _
        ";Port=" & sServPort & _
        ";DATABASE=" & sDbName & _
        ";USER=" & sUser & _
        ";PASSWORD=" & sPassWord & _
        ";OPTION=3" & _
        ";stmt=set names cp1251"
        Debug.Print ConnStr
        Debug.Print String(74, "-")
    
    
'Строим строку подключения ... - добавляем "ODBC;" в начало уже готовой (см выше)
    AConnectionString_ADOX = "ODBC;" & ConnStr
 
'Катплог
    Set cat = New ADOX.Catalog
    'Открываем каталог текущей базы
    Set cat.ActiveConnection = CurrentProject.Connection
 
'Удаление всех таблиц по именам
     For i = LBound(arrTables) To UBound(arrTables)
        sTblName = arrTables(i)
        s = sTblLocalPrefix & sTblName
        DelTable_ADOX s
    Next i
    cat.Tables.Refresh
    Debug.Print String(74, "-")
 
    If bDelOnly = True Then GoTo ReLinkTables_ADOX_Bye
'Подключение  всех по именам
    For i = LBound(arrTables) To UBound(arrTables)
        sTblName = arrTables(i)
        'Debug.Print Format(i, "000") & " - " & sTblName
        LinkTable_ADOX sTblName, AConnectionString_ADOX, sTblLocalPrefix & sTblName
    Next i
    
'Отчёт о проделанной работе
    'Debug.Print String(74, "-")
    Debug.Print "Подключено: " & Format(i, "000") & " таблиц " & Now
    Debug.Print String(74, "-")
 
    
ReLinkTables_ADOX_Bye:
    On Error Resume Next
    'Обновляем список таблиц
    cat.Tables.Refresh
    
    cat.ActiveConnection.Close
    Set cat = Nothing
    Set tbl = Nothing
    
    'Keep_ADO_Connection
    Exit Sub 'Ура!!!
 
ReLinkTables_ADOX_Err:
    s = "Error " & Err.Number & vbCrLf & Err.Description & vbCrLf & _
    "In procedure: ReLinkTables_ADOX in module: modCommon_ADOX"
    Debug.Print s
    MsgBox s, vbCritical, "Error in Application!"
    Err.Clear
    Resume ReLinkTables_ADOX_Bye
End Sub
Private Sub DelTable_ADOX(s$)
'Удаление подлинковки.
    On Error Resume Next
    cat.Tables.Delete s
    If Err = 0 Then Debug.Print s & " ... Deleted!"
    Err.Clear
End Sub
 
Private Sub LinkTable_ADOX(stRemTName As String, strConnect As String, Optional strLocalTableName As String = "")
'es 08.05.2017
'Подлинковка таблички MySQL Server с автоматическим созданием DSN (ADOX)
'Использует общие переменные данного модуля (так короче и возможно быстрее)
'-------------------------------------------------------------------------
'Аргументы:
'   stRemTName  = Имя таблицы на сервере
'   strConnect  = Строка подключения к серверу с "ODBC:DRIVER = ..."
'   strLocalTableName = Локальное Имя Таблицы
'-------------------------------------------------------------------------
 
On Err GoTo LinkTable_ADOX_Err
'Если локальное имя не указанно
    If strLocalTableName = "" Then strLocalTableName = stRemTName
    
     Set tbl = New ADOX.Table
 
'Установка параметров таблицы
    With tbl
        .Name = strLocalTableName
        Set .ParentCatalog = cat
        .Properties("Jet OLEDB:Link Provider String") = strConnect
        .Properties("Jet OLEDB:Remote Table Name") = stRemTName
        .Properties("Jet OLEDB:Create Link") = True
    End With
    
'Создаём новый обьект
    cat.Tables.Append tbl
    'cat.Tables.Refresh
    
LinkTable_ADOX_Bye:
    Exit Sub
 
LinkTable_ADOX_Err:
    'LinkTable_ADOX = Err.Number
    Debug.Print "Error " & Err.Number & vbCrLf & Err.Description & vbCrLf & _
            "in Function: esLinkTable_ADOX"
    Resume LinkTable_ADOX_Bye
End Sub

Hello,

I’m having trouble to connect to a mysql database which shows an error message as follow:

DataSource.Error : MySQL : Fatal error encountered during command execution.
Détails :
DataSourceKind=MySql
DataSourcePath=51.77.158.29;samfm58_merial
Message=Fatal error encountered during command execution.
ErrorCode=-2147467259

I can see the tables in the database in PowerQuery but I can’t seem to get a previous nor load anithing from the mysql db which I have a full access to and which i can load from MySQLQueryBrowser.

Does anyone ever had the same error and knows how to fix it?

Thanks in advance for the help

Thomas

You may encounter the following error with MySQL Server 8.0.25 or below when adding a new record:

Error when inserting data into MySQL

Cause

This is a known issue with MySQL Server below 8.0.26 with more recent connectors.

Resolution

To use the recent connectors (8.0.23+) the server must also be upgraded to 8.0.26 or higher. As of June 22, 2021 this has not yet been released. As a workaround, you can uninstall the more recent connector and install 8.0.22 from mysql.org.

  0 people found this article useful

  0 people found this article useful

Like this post? Please share to your friends:
  • Ошибка 2147319779 automation error library not registered
  • Ошибка 2147221164 класс не зарегистрирован
  • Ошибка 2147221003 при открытии файла
  • Ошибка 2147217900 не удалось выполнить sql запрос
  • Ошибка 2147024809 параметр задан неверно