I have this error that the SD_SQL library gives me and I don't understand since the query on MYSQL WorkBench the record is generated to me, i think its a datatime issue i pass as string or i wouldn't know
table mysql:
CREATE TABLE `tb01` (
`ms_gpt_01_01` varchar(45) NOT NULL,
`ms_gpt_01_02` varchar(45) DEFAULT NULL COMMENT 'ip client',
`ms_gpt_01_03` varchar(45) DEFAULT NULL COMMENT 'id client',
`ms_gpt_01_04` longtext COMMENT 'question',
`ms_gpt_01_05` longtext COMMENT 'aswer question',
`ms_gpt_01_06` datetime DEFAULT NULL,
`ms_gpt_01_07` varchar(45) NOT NULL DEFAULT 'False'
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='tabella request';
B4X:
' datetime mysql YYYY-MM-DD HH:MI:SS
DateTime.DateFormat = "yyyy-MM-dd HH:mm:ss"
Client_dataQuestion = DateTime.Date(DateTime.Now)
Dim query As String
query = "INSERT INTO `ms_gpt`.`tb01`" & "(`ms_gpt_01_01`," & "`ms_gpt_01_02`," & "`ms_gpt_01_03`," & "`ms_gpt_01_04`," & "`ms_gpt_01_05`," & "`ms_gpt_01_06`," & "`ms_gpt_01_07`)" & "VALUES" & _
"('" & Client_id & "-"& Rnd(100,9999) & "'," & _
"'" & Client_ip & "'," & _
"'" & Client_id & "'," & _
"'" & Client_question & "'," & _
"'" & Client_aswerQuestion & "'," & _
"'" & Client_dataQuestion & "'," & _
"'" & Client_statusQuestion & "');"
If MySql.IsInitialized = False Then
initializeMySQL
End If
Try
If MySql.ExecNonQuery(query) = False Then
MySql.Close
End If
Catch
MySql.Close
Log(LastException)
End Try
Query:
INSERT INTO `ms_gpt`.`tb01`(`ms_gpt_01_01`,`ms_gpt_01_02`,`ms_gpt_01_03`,`ms_gpt_01_04`,`ms_gpt_01_05`,`ms_gpt_01_06`,`ms_gpt_01_07`)VALUES('12345-1287','192.168.1.41','12345','chi era napoleone?','....','2023-03-27 18:50:52','false');
Error:
Waiting for debugger to connect...
Program started.
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
connected
java.lang.NullPointerException
at b4j.example.sd_sql.close(sd_sql.java:303)
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:566)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:132)
at b4j.example.sd_sql._close(sd_sql.java:92)
at b4j.example.b4xmainpage._button_sub_click(b4xmainpage.java:136)
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:566)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:629)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
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:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:100)
at anywheresoftware.b4a.BA$1.run(BA.java:236)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:834)
Errore di query
(NullPointerException) java.lang.NullPointerException
Last edited: