Error synchronizing data with database

System information: Operating system (distribution) and version openSUSE Leap 15.1, but happened also on 15.0 DBeaver version currently 6.0.5, but happened before. I think since 6.0.0 or even earli...

System information:

  • Operating system (distribution) and version
    openSUSE Leap 15.1, but happened also on 15.0
  • DBeaver version
    currently 6.0.5, but happened before. I think since 6.0.0 or even earlier
  • Java version
    openjdk 10.0.2 2018-07-17
  • Additional extensions
    none

Connection specification:

  • Database name and version
    10.2.22-MariaDB
  • Driver name
    mariadb-java-client-1.5.5.jar
  • Do you use tunnels or proxies (SSH, SOCKS, etc)?
    SSH tunnel

Describe the problem you’re observing:

When I try to edit and save data in one table it would throw an error Error synchronizing data with database (more info below). It doesn’t matter which column I’m trying to edit but it only happens in one table.
Removing DBeaver’s config directory so it would create a new one is helping but as I just found out — only temporary

Steps to reproduce, if exist:

Include any warning/errors/backtraces from the logs

SQL Error [1615] [HY000]: (conn:142203) Prepared statement needs to be re-prepared
Query is: UPDATE dane_nowe.pozycje_rezerwacji
SET usunięty=?
WHERE ID_pozycji=?, parameters [0,82391]
(conn:142203) Prepared statement needs to be re-prepared
Query is: UPDATE dane_nowe.pozycje_rezerwacji
SET usunięty=?
WHERE ID_pozycji=?, parameters [0,82391]
(conn:142203) Prepared statement needs to be re-prepared
Query is: UPDATE dane_nowe.pozycje_rezerwacji
SET usunięty=?
WHERE ID_pozycji=?, parameters [0,82391]
Prepared statement needs to be re-prepared
Query is: UPDATE dane_nowe.pozycje_rezerwacji
SET usunięty=?
WHERE ID_pozycji=?, parameters [0,82391]
Prepared statement needs to be re-prepared
Query is: UPDATE dane_nowe.pozycje_rezerwacji
SET usunięty=?
WHERE ID_pozycji=?, parameters [0,82391]

And here’s table structure

CREATE TABLE pozycje_rezerwacji (
ID_pozycji int(11) NOT NULL AUTO_INCREMENT COMMENT »,
ID_rezerwacji int(11) DEFAULT 0 COMMENT »,
ID_kartoteki int(11) DEFAULT 0 COMMENT »,
szer smallint(5) unsigned DEFAULT 0 COMMENT »,
wys smallint(5) unsigned DEFAULT 0 COMMENT »,
ilość decimal(10,3) unsigned DEFAULT 0.000 COMMENT »,
data_rezerwacji date DEFAULT NULL,
waga decimal(10,3) DEFAULT 0.000 COMMENT »,
usunięty tinyint(1) NOT NULL DEFAULT 0,
data_dodania datetime DEFAULT current_timestamp() COMMENT »,
wydane tinyint(1) NOT NULL DEFAULT 0,
rodzaj smallint(1) NOT NULL DEFAULT 0 COMMENT »,
niestandardowa tinyint(1) NOT NULL DEFAULT 0,
etykieta tinyint(1) NOT NULL DEFAULT 0 COMMENT »,
uszk_prod tinyint(1) NOT NULL DEFAULT 0 COMMENT »,
uszk_dost tinyint(1) NOT NULL DEFAULT 0 COMMENT »,
ID_optymalizacji int(11) NOT NULL DEFAULT 0 COMMENT »,
PRIMARY KEY (ID_pozycji)
) ENGINE=InnoDB AUTO_INCREMENT=86117 DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci AVG_ROW_LENGTH=84

Same here.

System information:

  • macOS 10.15.7 (19H2)
  • Version 7.2.2.202010041557
  • Additional extensions: n/a

Connection specification:

  • Database name and version: postgres
  • Driver name: jdbc (postgresql: 42.2.5, postgis-jdbc: 2.2.1, postgis-geometry: 2.5.0)
  • Do you use tunnels or proxies (SSH, SOCKS, etc)? no

Same:

System information:

  • Ubuntu 20.04
  • Version 7.2.2.202010041557
  • Additional extensions: n/a

Connection specification:

  • Database name and version: postgres
  • Driver name: jdbc
  • Do you use tunnels or proxies (SSH, SOCKS, etc)? no

Any error logs? What type has column, where field was changed?

Any error logs? What type has column, where field was changed?

Here is some error-related lines from /workspace6/.metadata/.log file.
!ENTRY org.jkiss.dbeaver.model 4 0 2020-10-13 13:41:59.584
!MESSAGE Object parameter [ec9247ec-cd67-11e8-bbe1-db78d8dac638] binding not supported
!SUBENTRY 1 org.jkiss.dbeaver.model 4 0 2020-10-13 13:41:59.584
!MESSAGE Object parameter [ec9247ec-cd67-11e8-bbe1-db78d8dac638] binding not supported
!STACK 0
org.jkiss.dbeaver.model.exec.DBCException: Object parameter [ec9247ec-cd67-11e8-bbe1-db78d8dac638] binding not supported
at org.jkiss.dbeaver.model.impl.data.DefaultValueHandler.bindValueObject(DefaultValueHandler.java:60)
at org.jkiss.dbeaver.model.impl.jdbc.struct.JDBCTable$2.bindStatement(JDBCTable.java:466)
at org.jkiss.dbeaver.model.impl.data.ExecuteBatchImpl.processBatch(ExecuteBatchImpl.java:156)
at org.jkiss.dbeaver.model.impl.data.ExecuteBatchImpl.execute(ExecuteBatchImpl.java:77)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetPersister$DataUpdaterJob.executeStatements(ResultSetPersister.java:804)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetPersister$DataUpdaterJob.lambda$1(ResultSetPersister.java:690)
at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:168)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetPersister$DataUpdaterJob.executeStatements(ResultSetPersister.java:689)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetPersister$DataUpdaterJob.run(ResultSetPersister.java:627)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetPersister.execute(ResultSetPersister.java:442)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetPersister.applyChanges(ResultSetPersister.java:170)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetViewer.saveChanges(ResultSetViewer.java:3781)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetViewer.applyChanges(ResultSetViewer.java:3754)
at org.jkiss.dbeaver.ui.editors.data.AbstractDataEditor.doSave(AbstractDataEditor.java:210)
at org.jkiss.dbeaver.ui.editors.entity.EntityEditor.doSave(EntityEditor.java:251)
at org.eclipse.ui.internal.SaveableHelper.lambda$0(SaveableHelper.java:156)
at org.eclipse.ui.internal.SaveableHelper.lambda$3(SaveableHelper.java:271)
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:436)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:352)
at org.eclipse.ui.internal.WorkbenchWindow.lambda$5(WorkbenchWindow.java:2375)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:72)
at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2373)
at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:278)
at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:260)
at org.eclipse.ui.internal.SaveableHelper.savePart(SaveableHelper.java:160)
at org.eclipse.ui.internal.WorkbenchPage.saveSaveable(WorkbenchPage.java:3820)
at org.eclipse.ui.internal.WorkbenchPage.saveEditor(WorkbenchPage.java:3833)
at org.eclipse.ui.internal.handlers.SaveHandler.execute(SaveHandler.java:57)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:283)
at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:97)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:318)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:252)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:173)
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:156)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:488)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:487)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(KeyBindingDispatcher.java:308)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:584)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:653)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.filterKeySequenceBindings(KeyBindingDispatcher.java:443)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.access$2(KeyBindingDispatcher.java:386)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher$KeyDownFilter.handleEvent(KeyBindingDispatcher.java:96)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1113)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4382)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1512)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1535)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1520)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1549)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1545)
at org.eclipse.swt.widgets.Canvas.sendKeyEvent(Canvas.java:522)
at org.eclipse.swt.widgets.Control.doCommandBySelector(Control.java:1081)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:6205)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
at org.eclipse.swt.internal.cocoa.NSResponder.interpretKeyEvents(NSResponder.java:59)
at org.eclipse.swt.widgets.Composite.keyDown(Composite.java:606)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:6037)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:235)
at org.eclipse.swt.widgets.Widget.windowSendEvent(Widget.java:2150)
at org.eclipse.swt.widgets.Shell.windowSendEvent(Shell.java:2401)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:6157)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
at org.eclipse.swt.widgets.Display.applicationSendEvent(Display.java:5407)
at org.eclipse.swt.widgets.Display.applicationProc(Display.java:5543)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
at org.eclipse.swt.internal.cocoa.NSApplication.sendEvent(NSApplication.java:117)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3788)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1160)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1049)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:658)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:557)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:154)
at org.jkiss.dbeaver.ui.app.standalone.DBeaverApplication.start(DBeaverApplication.java:234)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:657)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:594)
at org.eclipse.equinox.launcher.Main.run(Main.java:1447)

Table which i want to update has uuid as PK, and i update any column.

Example:
create table "test" (uuid uuid primary key, somecol int);
insert into "test" (uuid, somecol) values ('F6112239-0285-405E-B253-CB51337F3775', 10);

Next i’m trying to do update 10 => 20 of «somecol» via UI, then i get this:
Object parameter [f6112239-0285-405e-b253-cb51337f3775] binding not supported
on save

Same case.

System information:

  • Fedora 32
  • Version 7.2.2.202010041557
  • Additional extensions: n/a

Connection specification:

  • Database name and version: postgres
  • Driver name: jdbc (postgresql: 42.2.5, postgis-jdbc: 2.2.1, postgis-geometry: 2.5.0)
  • Do you use tunnels or proxies (SSH, SOCKS, etc)? no

I have the same issue when trying to delete a row from the «Data» tab of a «Table» editor where the primary key is of type GUID

System Information:

  • Operating System: Mac OS Catalina 10.15.7
  • DBeaver Version: 7.2.2.202010041557

Connection specification:

  • Database & Version: Postgres 10.14 (Ubuntu 10.14-0ubuntu0.18.04.1)
  • Driver name: JBDC (postgresql: 42.2.5; postgis-jbdc: 2.2.1; postgis-geometry 2.5.0)
  • Connection Scheme: Production (default settings)
  • Do you use tunnels or proxies (SSH, SOCKS, etc)?: No

I’m guessing it has something to do with the data type of the column used as the primary key?

Seeing the same issue on macOS 10.15.7 with a postgres 11 database, downgrading to DBeaver 7.2.1 fixes it.

Seeing the same error after recent update 7.2.2.202010041557

7.2.3.202010181902 problem is still there.

same here!
Version: 7.2.3.202010181902
OS: Ubuntu 20.04

Downgraded back to dbeaver version 7.1.2 and it worked (In Ubuntu 20.04 LTS).

Same
Version: 7.2.3.202010181902
OS: Ubuntu 18.04.5 LTS

@uslss Updated from 7.2.2 to the latest 7.2.3.202010191702 still have the issue. Doesn’t seem to fix it.
image

Fixed for me on Version 7.2.3.202010191702

Not working for me, I’ve just tried.

image

@alexbotelhoa
Não rolou não cara, estou na versão mais atual do momento (Version 7.2.3.202010181902) e estou com o erro. Acho que é alguma coisa com o UUID.

Don´t work for me in Version 7.2.3.202010181902

@alexbotelhoa
Cara, tive que remover e instalar o novo, então elel foi para Version 7.2.3.202010191702. Agora funcionou.
Valeu pela dica!

This version (Version 7.2.3.202010191702) works for me.

@kseniiaguzeeva Working for me

@AmaralMarti então, deve ser problema parecidos. O meu caso bastou jogar a versão anterior e funfou. Mas lgl vc ter conseguido instalar a última versão, vou reinstalar a ultima verão depois pra ver o que acontece. Vlw pela dica bro

Downgraded to Community Version 7.1.2.202007051953

Downgraded to Version 7.2.2.202010041557 now works (OS: Ubuntu 18.04.5 LTS).

I also had to downgrade to 7.2.2 in order to import a csv file which I need to do weekly. Was this fixed in 7.2.4? I’m hesitant to update now

It works correctly in 7.2.4. Please try.

It works correctly in 7.2.4. Please try.

In 7.2.4 (from November 02) not working for PostgreSQL: «_Object parameter […] binding not supported_».
Work correctly only in 7.2.1.

I was getting this error trying to save an edited record but upgrading to 7.2.4 fixed it — PostgreSQL, on Mac OS 10.15.7.

Retested version 7.2.4 (Windows 10 installer). The bug is only in the case of using custom base types. For example:

CREATE EXTENSION uint;  -- add unsigned int types / https://github.com/petere/pguint
CREATE TABLE test(id uint4);
INSERT INTO test VALUES(5);

If you then try to add or change any value in the «id» column via the DBeaver interface, an error occurs: «_Object parameter […] binding not supported_» (pguint is a popular extension, written by _PostgreSQL Core Team member_).
Version 7.2.1 is working correctly with uint types.

In the process of fixing this bug, please also fix the following 3 artifacts with user base types:
1) If you restart DBeaver, it «forgets» about user types (in particular, types added by the pguint extension). User base types, user domain types and user enum types. Specifically, when creating a column with a custom type (or changing the column type to a custom type), BDeaver generates the «_invalid data type_» error. If you open the «_Data Types_» item in the left panel tree, then dbeaver sees the custom types and the error is not generated.
2) There are no custom types (base, domain, enum) in the data type selection list.
3) When sorting data by field of custom integer base types (for example, uint4) via the UI, DBeaver sorts values as strings, not as numbers.

Issued this bug as a separate issue topic.

Error [08S01]: The last packet successfully received from the server was 1 144 454 milliseconds ago. The last packet sent successfully to the server was 1 144 525 milliseconds ago. is longer than the server configured value of ‘interactive_timeout’. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property ‘autoReconnect=true’ to avoid this problem. ?

english

software

mysql


10

ответов

Прочти ошибку, в ней пишется решение

да, спасибо, отличное решение!


Konstantin Meshcheryakov

да, спасибо, отличное решение!

You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property ‘autoReconnect=true’ to avoid this problem.


Alex

You should consider either expiring and/or testing…

а где это в настройках в бобре


Ilya Zviagin

Это на сервере

где на сервере? у меня опенсервер


Ilya Zviagin

А это в настройках mySQL

а где там настройки mysql


Konstantin Meshcheryakov

а где там настройки mysql

В файле конфигурации mysql

#sql #triggers #mariadb

Вопрос:

Я пытаюсь автоматизировать некоторые задачи в базе данных, а не в приложении. У нас есть небольшой MariaDB для продажи билетов. Когда билет продан, его статус должен быть установлен в значение NOT_VALID до тех пор, пока не будет произведена оплата. После оплаты билет необходимо установить на ДЕЙСТВИТЕЛЬНЫЙ. Сам счет — фактура находится в таблице «som_accounting», и с помощью справочной таблицы (som_accountingtickets-из-за ленивых дизайнерских решений) он указывает на билеты. Теперь я пытаюсь автоматизировать, чтобы флаг в таблице билетов был установлен на ДЕЙСТВИТЕЛЬНЫЙ, когда столбец PAYMENTSTATUS в таблице учета меняется с ОТКРЫТОГО (1) на ОПЛАЧЕННЫЙ (3).

Когда я использую это на консоли (dbeaver или терминале), это работает нормально:

 UPDATE som_ticket SET ID_ticketstatus = 4, activation_date = CURRENT_DATE()
WHERE ticketID IN
(SELECT act.ID_ticket FROM som_accountingticket act
   INNER JOIN (SELECT * FROM som_accounting) AS ac
       ON ac.accountingID = act.ID_accounting
   INNER JOIN (SELECT * FROM som_ticket) AS t2
       ON t2.ticketID = act.ID_ticket AND t2.ID_ticketstatus = '1'
   WHERE act.ID_accounting = '565');
 

Теперь я вставил это в триггер и получил ошибку:

 CREATE DEFINER=`<user>`@`%` TRIGGER `somt_au_accounting`
      AFTER UPDATE
      ON `som_accounting`
      
      FOR EACH ROW BEGIN
            
            IF NEW.ID_paymentstatus = 3 AND OLD.ID_paymentstatus = 1 THEN
                UPDATE som_ticket SET ID_ticketstatus = '4', 
                                            activation_date = CURRENT_DATE()
                    WHERE ticketID IN 
                              (SELECT act.ID_ticket FROM som_accountingticket act
                     INNER JOIN (SELECT * FROM som_accounting) AS ac
                                         ON ac.accountingID = act.ID_accounting
                                   INNER JOIN (SELECT * FROM som_ticket) AS t2
                                         ON t2.ticketID = act.ID_ticket
                                   AND t2.ID_ticketstatus = '1'
                                   WHERE act.ID_accounting = OLD.accountingID);
            END IF;
      END
 

База данных сообщает об этом:

 Error synchronizing data with database

Reason:
SQL-Fehler [08]: (conn:3) Could not read resultset: unexpected end of stream, read 0 bytes from 4
Query is: UPDATE d0294220.som_accounting
    SET ID_paymentstatus=?
    WHERE accountingID=?, parameters [3,568]
 

Почему он хорошо работал в консоли, но не в триггере?

MariaDB 10.5.8

Комментарии:

1. Ошибка выглядит так, как будто она вызвана каким-то другим запросом? … Ни одна часть запроса триггера не имеет SET ID_paymentstatus .

2. Набор нового ID_paymanetstatus выполняется в приложении. Если счет оплачивается, пользователь изменяет это значение в приложении с 1 (еще не оплачено) на 3 (оплачено), и триггер прослушивает это изменение и должен сделать все остальное.

3. Тогда единственное, что я вижу, это то, что запрос, перемещенный в триггер, ссылается на ту же таблицу, которая запускает триггер (при внутреннем соединении), что недопустимо. Cannot make changes to a table that is already in use (reading or writing) by the statement invoking the stored function. Эта информация из ограничений триггера MariaDB указана во второй информации о элементе маркера.

4. Теперь я разделил работу. Триггер проверяет только, нужно ли что-то делать: если статус оплаты изменился с 1 на 3, затем вызовите хранимую процедуру и передайте идентификатор учетной записи. Процедура выполняет поиск всех билетов для изменения и устанавливает их ДЕЙСТВИТЕЛЬНЫМИ.

ISSUE:

While synchronizing data between the PDA and MS SQL Server database, using Active Sync connection, the sync process fails at times and displays an empty error message box and occasionally it shows the following exception:

Error During Synchronization:

A native exception occurred.

ExceptionCode:0xc0000005

ExceptionAddress:0x01627b28

Reading: 0x1e000000

OK to terminate

CANCEL to debug

Moreover the .SDF file on the PDA gets corrupted. The ActiveSync connection drops as soon as the sync process fails. Later when the .SDF file is deleted and restored the synchronization is successful.

Note: The replication monitor in the SQL Server indicates that the synchronization was successful even when the above error occurs.

SCENARIO:

Steps to replicate:

  1. The PDA is placed on the cradle and a manual connection is established with the SQL Server database using the guest partnership. 
  2. The PDA application is invoked. Some data is saved in the local .sdf file via the application.
  3. The User clicks on the “Sync” menu option (Sample code below **) to start the sync process
  4. Most times the sync process is successful. Occasionally the above issue is encountered.

** Sample code where the app crashes we encounter the issue:

Public Sub Synchronize (ByVal vShowMessage As Boolean)

Dim ce As SqlCeReplication = Nothing

Try

ce = New SqlCeReplication

‘Set Internet properties.

ce.InternetUrl = vInternetURL ‘ «http://xx.xx.xx.xx/SQLCE/sscesa20.dll»

‘Set Publisher properties.

ce.Publisher = vPublisher ‘»CGH-RSMS»

ce.PublisherLogin = vPublisherLogin ‘»sa»

ce.PublisherPassword = vPublisherPassword ‘»xxxxxx»

ce.PublisherSecurityMode = SecurityType.DBAuthentication

ce.PublisherNetwork = NetworkType.DefaultNetwork

ce.PublisherDatabase = vPublisherDatabase ‘»RSMS»

ce.Publication = vPub_Name ‘»PUB_RSMS»

‘Set Subscriber properties.

ce.Subscriber = vSub_Name

ce.SubscriberConnectionString = «Data Source=» & DB_PATH & vDatabase_Name

If File.Exists(DB_PATH & vDatabase_Name) = False Then

ce.AddSubscription(AddOption.CreateDatabase)

End If

ce.Synchronize()

Catch ex As SqlCeException

If vShowMessage = True Then

MsgBox(ex.Message)

End If

Throw ex

Catch ex1 As Exception

If vShowMessage = True Then

MsgBox(ex1.Message)

End If

Throw ex1

Finally

ce = Nothing

End Try

End Sub

After power surge last night, I realized few availability databases (also known as a “database replica”) have an unhealthy data synchronization state. What I mean from unhealthy is that they have a status of “Not Synchronizing” in SQL Server Management Studio for both primary and all secondary availability group replicas (See below):

avalability_group_011

According to MSDN documentation here, this issue can be caused by the following:

  • The availability replica might be disconnected.
  • The data movement might be suspended.
  • The database might not be accessible.
  • There might be a temporary delay issue due to network latency or the load on the primary or secondary replica.

To investigate which one of those is relevant in my case, I tried to access the database in SQL Server Management Studio, but received the error similar to the one below:

The target database, ‘YourDatabase’, is participating in an availability group and is currently not accessible for queries. Either data movement is suspended or the availability replica is not enabled for read access. To allow read-only access to this and other databases in the availability group, enable read access to one or more secondary availability replicas in the group.  For more information, see the ALTER AVAILABILITY GROUP statement in SQL Server Books Online. (Microsoft SQL Server, Error: 976)

I also searched the SQL Server ErrorLogs for more information, and found following errors:

04/02/2014 12:06:23,spid37s,Unknown,AlwaysOn Availability Groups data movement for database ‘YourDatabase’ has been suspended for the following reason: “failover from partner” (Source ID 1; Source string: ‘SUSPEND_FROM_PARTNER’). To resume data movement on the database<c/> you will need to resume the database manually. For information about how to resume an availability database<c/> see SQL Server Books Online.

04/02/2014 12:06:23,spid37s,Unknown,The recovery LSN (969:3766:1) was identified for the database with ID 7. This is an informational message only. No user action is required.

04/02/2014 12:06:23,spid37s,Unknown,Error: 35285<c/> Severity: 16<c/> State: 1.

04/02/2014 12:06:23,spid37s,Unknown,AlwaysOn Availability Groups connection with primary database established for secondary database ‘YourDatabase’ on the availability replica with Replica ID: {f46ea26e-3162-4f49-97c6-b93946e78733}. This is an informational message only. No user action is required.

This information from ErrorLogs is quiet useful, as it tells me what’s wrong and how I can fix this issue. First, it tells that the attempt was made to connect to the primary availability replica. Then, it shows the “recovery LSN” for the database. And, finally, it tells that the Availability Groups data movement for database has been suspended, and we should manually resume the movement.

Solution: Resuming data movement on the database manually

To resume data movement on the database manually, I simply execute the following Transact-SQL statement on primary and all secondary replicas for the databases that are showing this status:

ALTER DATABASE [YourDatabase] SET HADR RESUME

After I issued this statement, the database is successfully synchronized.

Further Reading

  • Data synchronization state of some availability database is not healthy
  • ALTER DATABASE SET HADR (Transact-SQL)

Понравилась статья? Поделить с друзьями:
  • Error symgetsymfromaddr64 getlasterror попытка обращения к неверному адресу
  • Error symgetlinefromaddr64 getlasterror 487
  • Error symbol grub isprint not found
  • Error symbol grub is lockdown not found astra linux
  • Error symbol grub file filters not found как исправить