com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException

Hier melden JVerein-Benutzer ihre Fehler

Moderator: heiner

Antworten
FullHD
Beiträge: 8
Registriert: Samstag 6. November 2021, 12:25

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException

Beitrag von FullHD »

Hallo zusammen,

ich nochmal mit einem Fehler, der mich zur Weißglut treibt... Ob mir jemand helfen kann, weiß ich gar nicht, weil ich mit der Version arbeite, die eine separate Belegnummer ermöglicht.
Die Version kommt ursprünglich von https://github.com/VinRud/jverein/tree/ ... elegnummer und ist dann bei https://github.com/kpatzwald/jverein/tr ... elegnummer integriert worden. Die Fehlermeldung unten tritt in beiden Versionen auf.
Ich habe das Gefühl, dass es wieder mit meiner Java oder MySQL-Version zusammenhängt, aber ich habe keine Ahnung wo ich ansetzen soll. Die MySQL Version (bzw. Maria DB) wird ja auch durch All Inkl. als Hoster vorgegeben.

Code: Alles auswählen

error while executing sql statement
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '>= '2022-11-01 00:00:00' AND datum <= '2023-10-31 00:00:00'' at line 1
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:403)
	at com.mysql.jdbc.Util.getInstance(Util.java:386)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3933)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3869)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2675)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2465)
	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1915)
	at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2023)
	at de.willuhn.datasource.db.DBServiceImpl.execute(DBServiceImpl.java:457)
	at de.jost_net.JVerein.gui.control.BuchungsControl.getLastBelegnummer(BuchungsControl.java:254)
	at de.jost_net.JVerein.io.Buchungsuebernahme.importiereUmsatz(Buchungsuebernahme.java:149)
	at de.jost_net.JVerein.io.Buchungsuebernahme.leseHibiscus(Buchungsuebernahme.java:114)
	at de.jost_net.JVerein.io.Buchungsuebernahme.uebernahme(Buchungsuebernahme.java:59)
	at de.jost_net.JVerein.io.Buchungsuebernahme.<init>(Buchungsuebernahme.java:45)
	at de.jost_net.JVerein.gui.view.BuchungsuebernahmeView$1.handleAction(BuchungsuebernahmeView.java:48)
	at de.willuhn.jameica.gui.parts.Button$1$1.run(Button.java:174)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
	at de.willuhn.jameica.gui.GUI$6.run(GUI.java:921)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:183)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4785)
	at de.willuhn.jameica.gui.GUI.startSync(GUI.java:917)
	at de.willuhn.jameica.gui.parts.Button$1.widgetSelected(Button.java:168)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:252)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4256)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4054)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3642)
	at de.willuhn.jameica.gui.GUI.loop(GUI.java:938)
	at de.willuhn.jameica.gui.GUI.init(GUI.java:335)
	at de.willuhn.jameica.system.Application.init(Application.java:145)
	at de.willuhn.jameica.system.Application.newInstance(Application.java:87)
	at de.willuhn.jameica.Main.main(Main.java:78)
Viele Grüße
Tobias
Benutzeravatar
hibiscus
Beiträge: 118
Registriert: Donnerstag 31. Mai 2018, 08:55

Re: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException

Beitrag von hibiscus »

Du könntest das Loglevel unter Datei->Einstellungen mal auf "DEBUG" stellen. Dann sollte im Log das fehlerhafte SQL-Statement mit ausgegeben werden.
FullHD
Beiträge: 8
Registriert: Samstag 6. November 2021, 12:25

Re: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException

Beitrag von FullHD »

Guten Morgen!

Danke für den Tipp mit dem erweiterten Log.

Code: Alles auswählen

[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.jameica.gui.Navigation.start] executing navigation entry de.jost_net.JVerein.gui.navigation.MyItem.Hibiscus-Buchungen [Hibiscus-Buchungen]
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.jameica.services.BeanService.get]   creating new class de.jost_net.JVerein.gui.view.BuchungsuebernahmeView
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.jameica.gui.GUI.startView] starting view: de.jost_net.JVerein.gui.view.BuchungsuebernahmeView
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.jameica.messaging.NamedConcurrentQueue.deliver] deliver message de.willuhn.jameica.messaging.QueryMessage@2af69643
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.jameica.gui.GUI$5.run] disposing previous view
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.jameica.messaging.NamedConcurrentQueue.unRegisterMessageConsumer] queue [default]: unregistering message consumer de.willuhn.jameica.hbci.gui.input.KontoInput$SaldoMessageConsumer
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.jameica.messaging.NamedConcurrentQueue.unRegisterMessageConsumer] queue [default]: unregistering message consumer de.willuhn.jameica.hbci.gui.boxes.Overview$SaldoMessageConsumer
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.jameica.gui.parts.table.FeatureClipboard$1.widgetDisposed] unbound de.willuhn.jameica.gui.parts.table.FeatureClipboard$2@81b5db0
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.jameica.messaging.NamedConcurrentQueue.unRegisterMessageConsumer] queue hibiscus.sync.status: unregistering message consumer de.willuhn.jameica.hbci.gui.parts.SynchronizeList$SyncMessageConsumer
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.jameica.messaging.NamedConcurrentQueue.unRegisterMessageConsumer] queue jameica.gui.view.unbind: unregistering message consumer de.willuhn.jameica.hbci.gui.parts.SynchronizeList$CacheMessageConsumer
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.jameica.gui.parts.table.FeatureClipboard$1.widgetDisposed] unbound de.willuhn.jameica.gui.parts.table.FeatureClipboard$2@43e1692f
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.jameica.gui.parts.table.FeatureShortcut$1.widgetDisposed] unbound ALT+G: de.willuhn.jameica.hbci.gui.action.UmsatzMarkChecked
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.jameica.gui.parts.table.FeatureShortcut$1.widgetDisposed] unbound ALT+CTRL+G: de.willuhn.jameica.hbci.gui.action.UmsatzMarkUnChecked
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.jameica.gui.parts.table.FeatureShortcut$1.widgetDisposed] unbound ALT+K: de.willuhn.jameica.hbci.gui.action.UmsatzAssign
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.jameica.messaging.NamedConcurrentQueue.unRegisterMessageConsumer] queue [default]: unregistering message consumer de.willuhn.jameica.hbci.gui.parts.UmsatzList$UmsatzChangedMessageConsumer
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.jameica.messaging.NamedConcurrentQueue.unRegisterMessageConsumer] queue [default]: unregistering message consumer de.willuhn.jameica.hbci.gui.parts.UmsatzList$UmsatzNewMessageConsumer
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.jameica.gui.GUI$5.run] dispose finished
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.jameica.gui.GUI$5.run] adding view de.willuhn.jameica.gui.internal.views.Start to history
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.jameica.messaging.NamedConcurrentQueue.<init>] creating message queue jameica.bookmark.created
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.jameica.messaging.NamedConcurrentQueue.registerMessageConsumer] queue jameica.bookmark.created: registering message consumer de.willuhn.jameica.gui.internal.parts.PanelButtonBookmark$MyCreateMessageConsumer
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.jameica.messaging.NamedConcurrentQueue.<init>] creating message queue jameica.bookmark.deleted
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.jameica.messaging.NamedConcurrentQueue.registerMessageConsumer] queue jameica.bookmark.deleted: registering message consumer de.willuhn.jameica.gui.internal.parts.PanelButtonBookmark$MyDeleteMessageConsumer
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.jameica.messaging.NamedConcurrentQueue.<init>] creating message queue jameica.attachment.added
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.jameica.messaging.NamedConcurrentQueue.registerMessageConsumer] queue jameica.attachment.added: registering message consumer de.willuhn.jameica.gui.internal.parts.PanelButtonAttachment$OnAdd
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.jameica.messaging.NamedConcurrentQueue.<init>] creating message queue jameica.attachment.deleted
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.jameica.messaging.NamedConcurrentQueue.registerMessageConsumer] queue jameica.attachment.deleted: registering message consumer de.willuhn.jameica.gui.internal.parts.PanelButtonAttachment$OnDel
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.jameica.messaging.NamedConcurrentQueue.sendSyncMessage] no message consumers found, ignoring message
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.util.ClassFinder.findImplementors] used time to search for implementors of de.jost_net.JVerein.rmi.Konto: 10 millis]
[Wed Jun 14 11:03:27 CEST 2023][INFO][main][de.willuhn.datasource.db.DBServiceImpl.getConnection] connection check failed, creating new connection. message: The last packet successfully received from the server was 2.791.425 milliseconds ago.  The last packet sent successfully to the server was 2.791.442 milliseconds ago. is longer than the server configured value of 'wait_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.
[Wed Jun 14 11:03:27 CEST 2023][INFO][main][de.willuhn.datasource.db.DBServiceImpl.createConnection] creating new connection
[Wed Jun 14 11:03:27 CEST 2023][INFO][main][de.willuhn.datasource.db.DBServiceImpl.getConnection] created new connection for <local>
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.datasource.db.DBIteratorImpl.init] executing sql query: com.mysql.jdbc.JDBC42PreparedStatement@43045f9f: select konto.* from konto where hibiscusid > 0 ORDER BY nummer
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.datasource.db.AbstractDBObject.load] executing query: select * from konto where id = 10
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.datasource.db.AbstractDBObject.load] executing query: select * from konto where id = 2
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.datasource.db.AbstractDBObject.load] executing query: select * from konto where id = 6
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.datasource.db.AbstractDBObject.load] executing query: select * from konto where id = 8
[Wed Jun 14 11:03:27 CEST 2023][DEBUG][main][de.willuhn.datasource.db.DBIteratorImpl.init] executing sql query: com.mysql.jdbc.JDBC42PreparedStatement@a66e580: select konto.* from konto where hibiscusid = -1 ORDER BY nummer
[Wed Jun 14 11:03:29 CEST 2023][INFO][main][de.jost_net.JVerein.io.Buchungsuebernahme.uebernahme] Buchungsübernahme zu JVerein gestartet
[Wed Jun 14 11:03:29 CEST 2023][DEBUG][main][de.willuhn.datasource.db.DBIteratorImpl.init] executing sql query: com.mysql.jdbc.JDBC42PreparedStatement@7e74a380: select konto.* from konto where hibiscusid > 0
[Wed Jun 14 11:03:29 CEST 2023][DEBUG][main][de.willuhn.util.ClassFinder.findImplementors] used time to search for implementors of de.jost_net.JVerein.rmi.Jahresabschluss: 0 millis]
[Wed Jun 14 11:03:29 CEST 2023][DEBUG][main][de.willuhn.datasource.db.DBIteratorImpl.init] executing sql query: com.mysql.jdbc.JDBC42PreparedStatement@18d910b3: select jahresabschluss.* from jahresabschluss order by bis desc
[Wed Jun 14 11:03:29 CEST 2023][DEBUG][main][de.willuhn.jameica.system.ServiceFactory.lookup] searching for service database for plugin de.willuhn.jameica.hbci.HBCI
[Wed Jun 14 11:03:29 CEST 2023][DEBUG][main][de.willuhn.jameica.system.ServiceFactory.lookup] found local or cached remote service
[Wed Jun 14 11:03:29 CEST 2023][DEBUG][main][de.willuhn.util.ClassFinder.findImplementors] used time to search for implementors of de.willuhn.jameica.hbci.rmi.Umsatz: 0 millis]
[Wed Jun 14 11:03:29 CEST 2023][INFO][main][de.jost_net.JVerein.io.Buchungsuebernahme.leseHibiscus] datum=2022-10-31
[Wed Jun 14 11:03:29 CEST 2023][DEBUG][main][de.willuhn.datasource.db.DBIteratorImpl.init] executing sql query: com.mysql.jdbc.JDBC42PreparedStatement@a451491: select umsatz.* from umsatz where id > 825 and konto_id = 2 and datum > '2022-10-31' ORDER BY id
[Wed Jun 14 11:03:29 CEST 2023][DEBUG][main][de.willuhn.util.ClassFinder.findImplementors] used time to search for implementors of de.jost_net.JVerein.rmi.Buchung: 1 millis]
[Wed Jun 14 11:03:29 CEST 2023][DEBUG][main][de.willuhn.datasource.db.DBIteratorImpl.init] executing sql query: com.mysql.jdbc.JDBC42PreparedStatement@1e253c9d: select konto.* from konto
[Wed Jun 14 11:03:29 CEST 2023][ERROR][main][de.willuhn.datasource.db.DBServiceImpl.execute] error while executing sql statement
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '>= '2022-11-01 00:00:00' AND datum <= '2023-10-31 00:00:00'' at line 1
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:403)
	at com.mysql.jdbc.Util.getInstance(Util.java:386)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3933)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3869)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2675)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2465)
	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1915)
	at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2023)
	at de.willuhn.datasource.db.DBServiceImpl.execute(DBServiceImpl.java:457)
	at de.jost_net.JVerein.gui.control.BuchungsControl.getLastBelegnummer(BuchungsControl.java:254)
	at de.jost_net.JVerein.io.Buchungsuebernahme.importiereUmsatz(Buchungsuebernahme.java:149)
	at de.jost_net.JVerein.io.Buchungsuebernahme.leseHibiscus(Buchungsuebernahme.java:114)
	at de.jost_net.JVerein.io.Buchungsuebernahme.uebernahme(Buchungsuebernahme.java:59)
	at de.jost_net.JVerein.io.Buchungsuebernahme.<init>(Buchungsuebernahme.java:45)
	at de.jost_net.JVerein.gui.view.BuchungsuebernahmeView$1.handleAction(BuchungsuebernahmeView.java:48)
	at de.willuhn.jameica.gui.parts.Button$1$1.run(Button.java:174)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
	at de.willuhn.jameica.gui.GUI$6.run(GUI.java:921)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:183)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4785)
	at de.willuhn.jameica.gui.GUI.startSync(GUI.java:917)
	at de.willuhn.jameica.gui.parts.Button$1.widgetSelected(Button.java:168)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:252)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4256)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4054)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3642)
	at de.willuhn.jameica.gui.GUI.loop(GUI.java:938)
	at de.willuhn.jameica.gui.GUI.init(GUI.java:335)
	at de.willuhn.jameica.system.Application.init(Application.java:145)
	at de.willuhn.jameica.system.Application.newInstance(Application.java:87)
	at de.willuhn.jameica.Main.main(Main.java:78)

[Wed Jun 14 11:03:29 CEST 2023][ERROR][main][de.jost_net.JVerein.io.Buchungsuebernahme.uebernahme] Buchungsübernahme zu JVerein fehlerhaft
java.rmi.RemoteException: error while executing sql statement: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '>= '2022-11-01 00:00:00' AND datum <= '2023-10-31 00:00:00'' at line 1; nested exception is: 
	com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '>= '2022-11-01 00:00:00' AND datum <= '2023-10-31 00:00:00'' at line 1
	at de.willuhn.datasource.db.DBServiceImpl.execute(DBServiceImpl.java:463)
	at de.jost_net.JVerein.gui.control.BuchungsControl.getLastBelegnummer(BuchungsControl.java:254)
	at de.jost_net.JVerein.io.Buchungsuebernahme.importiereUmsatz(Buchungsuebernahme.java:149)
	at de.jost_net.JVerein.io.Buchungsuebernahme.leseHibiscus(Buchungsuebernahme.java:114)
	at de.jost_net.JVerein.io.Buchungsuebernahme.uebernahme(Buchungsuebernahme.java:59)
	at de.jost_net.JVerein.io.Buchungsuebernahme.<init>(Buchungsuebernahme.java:45)
	at de.jost_net.JVerein.gui.view.BuchungsuebernahmeView$1.handleAction(BuchungsuebernahmeView.java:48)
	at de.willuhn.jameica.gui.parts.Button$1$1.run(Button.java:174)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
	at de.willuhn.jameica.gui.GUI$6.run(GUI.java:921)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:183)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4785)
	at de.willuhn.jameica.gui.GUI.startSync(GUI.java:917)
	at de.willuhn.jameica.gui.parts.Button$1.widgetSelected(Button.java:168)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:252)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4256)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4054)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3642)
	at de.willuhn.jameica.gui.GUI.loop(GUI.java:938)
	at de.willuhn.jameica.gui.GUI.init(GUI.java:335)
	at de.willuhn.jameica.system.Application.init(Application.java:145)
	at de.willuhn.jameica.system.Application.newInstance(Application.java:87)
	at de.willuhn.jameica.Main.main(Main.java:78)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '>= '2022-11-01 00:00:00' AND datum <= '2023-10-31 00:00:00'' at line 1
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:403)
	at com.mysql.jdbc.Util.getInstance(Util.java:386)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3933)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3869)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2675)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2465)
	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1915)
	at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2023)
	at de.willuhn.datasource.db.DBServiceImpl.execute(DBServiceImpl.java:457)
	... 24 more

[Wed Jun 14 11:03:29 CEST 2023][DEBUG][main][de.willuhn.jameica.gui.dialogs.AbstractDialog$1.run] modal type: primary
[Wed Jun 14 11:03:29 CEST 2023][DEBUG][main][de.willuhn.jameica.gui.dialogs.AbstractDialog$4.run] using custom dialog size: 650x400
[Wed Jun 14 11:03:30 CEST 2023][DEBUG][main][de.willuhn.jameica.gui.dialogs.AbstractDialog.close] closing dialog
[Wed Jun 14 11:03:30 CEST 2023][DEBUG][main][de.willuhn.jameica.gui.dialogs.AbstractDialog$5.run] dialog closed
[Wed Jun 14 11:03:30 CEST 2023][DEBUG][main][de.willuhn.jameica.gui.dialogs.AbstractDialog.close] notifying listeners
[Wed Jun 14 11:03:31 CEST 2023][DEBUG][main][de.willuhn.jameica.gui.parts.table.FeatureClipboard.applyShortcut] bound de.willuhn.jameica.gui.parts.table.FeatureClipboard$2@5f254608
Benutzeravatar
hibiscus
Beiträge: 118
Registriert: Donnerstag 31. Mai 2018, 08:55

Re: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException

Beitrag von hibiscus »

Schade. Ist leider auch nicht wirklich erhellend. Wenn da aber ein echter Syntax-Fehler drin ist, sollte das Problem auch bei anderen Usern auftreten.
NicoB77
Beiträge: 138
Registriert: Freitag 21. April 2017, 21:14
Verein: Pollingua e.V.
Mitglieder: 50
JVerein-Version: Entwicklerversion
Betriebssystem: Linux

Re: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException

Beitrag von NicoB77 »

Der Fehler scheint in diesem Code (Zeile 238) zu sein, und zwar in der ersten if-Bedingung: da muss || statt && stehen. Mit dem aktuellen Code funktioniert nur Belegnummer pro Jahr und Konto gleichzeitig oder weder noch. Für mich sieht die Fehlermeldung so aus, als hättest Du pro Jahr gewählt, aber nicht pro Konto.

Da das Feature nicht in einer offiziellen Version ist und nur mit Belegnummern auftritt, betrifft es vermutlich nicht viele Nutzer. Ich habe die Änderungen in meiner Version nicht übernommen.

Code: Alles auswählen

	List<Object> arg_list = new ArrayList<Object>();
        String sql = "SELECT max(belegnummer) FROM buchung";
        if (Einstellungen.getEinstellung().getBelegnummerProJahr()
            && Einstellungen.getEinstellung().getBelegnummerProKonto()) {
          sql += " WHERE ";
        }
        if (Einstellungen.getEinstellung().getBelegnummerProJahr()) {
          sql += "datum >= ? AND datum <= ?";
          arg_list.add(LastBeginnGeschaeftsjahr.getTime());
          arg_list.add(LastEndeGeschaeftsjahr.getTime());
          if (Einstellungen.getEinstellung().getBelegnummerProKonto()) {
            sql += " AND ";
          }
        }
        if (Einstellungen.getEinstellung().getBelegnummerProKonto()) {
          sql += "konto = " + LastKontoId;
        }
Benutzeravatar
hibiscus
Beiträge: 118
Registriert: Donnerstag 31. Mai 2018, 08:55

Re: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException

Beitrag von hibiscus »

Stimmt. Das "WHERE" fehlt dann. Hatte den Code auch angeschaut, das aber übersehen.
FullHD
Beiträge: 8
Registriert: Samstag 6. November 2021, 12:25

Re: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException

Beitrag von FullHD »

Wow, ich danke euch! Wirklich vielen Dank für die Hilfe. Dann kann ich jetzt doch erstmal noch weiter bei JVerein bleiben. War schon gezwungenermaßen auf der Suche nach was Neuem, weil ich die Belegnummern nicht jedes Jahr von Hand in der Datenbank ergänzen wollte...

Ich weiß, dass das Feature für den Rest hier nicht so wichtig zu sein scheint, aber ohne wäre ich beim Buchungsjournal echt aufgeschmissen.
Antworten