Меню

Проверка на соответствие xml схеме ошибка 2147467259

Symptoms

If you try to use a Microsoft Jet (Access) database from multiple instances of the same application either on the same computer or on different computers, you receive the following error message:

-2147467259 Error ODBC Microsoft Access Driver: The database has been placed in a state by an unknown user that prevents it from being opened or locked.

This error occurs with both the Microsoft ODBC Driver for Access and the OLE DB Provider for Jet.

Cause

To run an .mdb file by multiple instances, Jet makes use of a lock delay and retry interval. However, under high load conditions, you may exceed these intervals.

Resolution

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs.
If you have limited programming experience, you may want to contact a Microsoft Certified Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites:

Microsoft Certified Partners — https://partner.microsoft.com/global/30000104

Microsoft Advisory Services — http://support.microsoft.com/gp/advisoryservice

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMSThe following workaround extends the retry delay for Jet so that you can use additional instances. However, it is not recommended that you use this workaround if a high number of updates are being formed; this workaround is intended only for reading databases.

You can add the following sample error handler to your code. Please note that this handler only works with ADO and uses the Sleep function, which you must declare in your general declarations section.

RetryHandler:
' Retry until MAX_RETRIES are hit to increment your error count.
errorcount = errorcount + 1
If errorcount < MAX_RETRIES Then

' Sleep a random amount of time, and retry the same operation.
Sleep Int(MAX_SLEEP_INTERVAL * Rnd) + 1
Resume
Else
' Retries did not help. Show the error, and fall out.
MsgBox Err.Number & " " & Err.Description
Exit Sub
End If

Status

This behavior is by design.

More Information

The above-mentioned workaround is only for read-only mode. Microsoft does not support placing Jet .mdb files under high user load. Microsoft strongly recommends that you use Microsoft SQL Server or Microsoft Data Engine (MSDE) instead of Access when high user loads (that is, more than 15 instances) are required or anticipated, especially when updating is required.

References

For more information about the Sleep function, refer to the MSDN Library documentation.

Need more help?

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,7514 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

8141 gold badge12 silver badges19 bronze badges

RRS feed

  • Remove From My Forums
  • Question

  • Running application on client machine that is causing the following errors (Windows Server 2012 R2, SQL 2016:

    [Microsoft][ODBC SQL Server Driver]Communication link failure (-2147467259).

    [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionWrite (send()). (-2147467259). Cannot start more transactions
    on this session. (-2147168237)»

    Cannot start more transactions on this session. (-2147168237)

    Please help fix these errors.

All replies

  • usually I’ve seen this issue due to network unavailability

    Check if you’ve any issues with your network connection, latency etc


    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    —————————-
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

    • Marked as answer by

      Thursday, February 8, 2018 9:06 PM

    • Unmarked as answer by
      tygerl
      Monday, February 12, 2018 12:39 PM
  • Xi,

    Windows Automatic Updates were disabled to start.  I did notice that the NIC1 adapter was being accessed as a secondary adapter when it is the one with the connection so I moved this up to #1.  Network connection is now working better.

    However, when leaving the application running on the client computer after a short amount of time we start getting the errors: Connection failure (-2147467259),  [DBNETLIB][ConnectionWrite
    (send()).]General network error. Check your network documentation. (-2147467259),  
    SharedDBLogOut: Connection failure (-2147467259).

RRS feed

  • Remove From My Forums
  • Question

  • Running application on client machine that is causing the following errors (Windows Server 2012 R2, SQL 2016:

    [Microsoft][ODBC SQL Server Driver]Communication link failure (-2147467259).

    [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionWrite (send()). (-2147467259). Cannot start more transactions
    on this session. (-2147168237)»

    Cannot start more transactions on this session. (-2147168237)

    Please help fix these errors.

All replies

  • usually I’ve seen this issue due to network unavailability

    Check if you’ve any issues with your network connection, latency etc


    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    —————————-
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

    • Marked as answer by

      Thursday, February 8, 2018 9:06 PM

    • Unmarked as answer by
      tygerl
      Monday, February 12, 2018 12:39 PM
  • Xi,

    Windows Automatic Updates were disabled to start.  I did notice that the NIC1 adapter was being accessed as a secondary adapter when it is the one with the connection so I moved this up to #1.  Network connection is now working better.

    However, when leaving the application running on the client computer after a short amount of time we start getting the errors: Connection failure (-2147467259),  [DBNETLIB][ConnectionWrite
    (send()).]General network error. Check your network documentation. (-2147467259),  
    SharedDBLogOut: Connection failure (-2147467259).

Icon Ex Номер ошибки: Ошибка 2147467259
Название ошибки: RealPlayer Error 2147467259
Описание ошибки: Runtime Error.
Разработчик: RealNetworks, Inc.
Программное обеспечение: RealPlayer
Относится к: Windows XP, Vista, 7, 8, 10, 11

Сводка «RealPlayer Error 2147467259

Эксперты обычно называют «RealPlayer Error 2147467259» «ошибкой времени выполнения». Когда дело доходит до программного обеспечения, как RealPlayer, инженеры могут использовать различные инструменты, чтобы попытаться сорвать эти ошибки как можно скорее. К сожалению, такие проблемы, как ошибка 2147467259, могут не быть исправлены на этом заключительном этапе.

Пользователи RealPlayer могут столкнуться с ошибкой 2147467259, вызванной нормальным использованием приложения, которое также может читать как «Runtime Error.». После возникновения ошибки 2147467259 пользователь программного обеспечения имеет возможность сообщить разработчику об этой проблеме. Команда программирования может использовать эту информацию для поиска и устранения проблемы (разработка обновления). Эта ситуация происходит из-за обновления программного обеспечения RealPlayer является одним из решений ошибок 2147467259 ошибок и других проблем.

Почему происходит ошибка времени выполнения 2147467259?

Проблема с исходным кодом RealPlayer приведет к этому «RealPlayer Error 2147467259», чаще всего на этапе запуска. Мы можем определить, что ошибки во время выполнения ошибки 2147467259 происходят из:

Ошибка 2147467259 Crash — ошибка 2147467259 блокирует любой вход, и это может привести к сбою машины. Если RealPlayer не может обработать данный ввод, или он не может получить требуемый вывод, это обычно происходит.

Утечка памяти «RealPlayer Error 2147467259» — последствия утечки памяти RealPlayer связаны с неисправной операционной системой. Потенциальные триггеры могут быть «бесконечным циклом», или когда программа выполняет «цикл» или повторение снова и снова.

Ошибка 2147467259 Logic Error — Вы можете столкнуться с логической ошибкой, когда программа дает неправильные результаты, даже если пользователь указывает правильное значение. Это может произойти, когда исходный код RealNetworks, Inc. имеет уязвимость в отношении передачи данных.

Основные причины RealNetworks, Inc. ошибок, связанных с файлом RealPlayer Error 2147467259, включают отсутствие или повреждение файла, или, в некоторых случаях, заражение связанного RealPlayer вредоносным ПО в прошлом или настоящем. Как правило, самый лучший и простой способ устранения ошибок, связанных с файлами RealNetworks, Inc., является замена файлов. Кроме того, некоторые ошибки RealPlayer Error 2147467259 могут возникать по причине наличия неправильных ссылок на реестр. По этой причине для очистки недействительных записей рекомендуется выполнить сканирование реестра.

Распространенные проблемы RealPlayer Error 2147467259

Частичный список ошибок RealPlayer Error 2147467259 RealPlayer:

  • «Ошибка программного обеспечения RealPlayer Error 2147467259. «
  • «RealPlayer Error 2147467259 не является приложением Win32.»
  • «Извините, RealPlayer Error 2147467259 столкнулся с проблемой. «
  • «RealPlayer Error 2147467259 не может быть найден. «
  • «RealPlayer Error 2147467259 не найден.»
  • «Ошибка запуска программы: RealPlayer Error 2147467259.»
  • «Файл RealPlayer Error 2147467259 не запущен.»
  • «RealPlayer Error 2147467259 остановлен. «
  • «RealPlayer Error 2147467259: путь приложения является ошибкой. «

Эти сообщения об ошибках RealNetworks, Inc. могут появляться во время установки программы, в то время как программа, связанная с RealPlayer Error 2147467259 (например, RealPlayer) работает, во время запуска или завершения работы Windows, или даже во время установки операционной системы Windows. Отслеживание того, когда и где возникает ошибка RealPlayer Error 2147467259, является важной информацией при устранении проблемы.

Причины проблем RealPlayer Error 2147467259

Проблемы RealPlayer Error 2147467259 могут быть отнесены к поврежденным или отсутствующим файлам, содержащим ошибки записям реестра, связанным с RealPlayer Error 2147467259, или к вирусам / вредоносному ПО.

Точнее, ошибки RealPlayer Error 2147467259, созданные из:

  • Недопустимые разделы реестра RealPlayer Error 2147467259/повреждены.
  • Вредоносные программы заразили RealPlayer Error 2147467259, создавая повреждение.
  • RealPlayer Error 2147467259 злонамеренно или ошибочно удален другим программным обеспечением (кроме RealPlayer).
  • Другое программное приложение, конфликтующее с RealPlayer Error 2147467259.
  • RealPlayer (RealPlayer Error 2147467259) поврежден во время загрузки или установки.

Продукт Solvusoft

Загрузка
WinThruster 2022 — Проверьте свой компьютер на наличие ошибок.

Совместима с Windows 2000, XP, Vista, 7, 8, 10 и 11

Установить необязательные продукты — WinThruster (Solvusoft) | Лицензия | Политика защиты личных сведений | Условия | Удаление

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

0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии

А вот еще интересные материалы:

  • Яшка сломя голову остановился исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного где ошибка
  • Проверка памяти на ошибки bios
  • Проверка на ошибку эксель