E Ederson Kerber Member Licensed User Dec 3, 2018 #1 Hi, We are developing an app with Postgresql with JRDC2. Following the https://www.b4x.com/android/forum/t...-rdc-remote-database-connector.61801/#content post we can connect to the database and execute queries (selects). But when we run Insert, Update or Delete we get an error: ResponseError. Reason: org.postgresql.util.PSQLException: The column index is out of range: 1, number of columns: 0., Response: <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> <title>Error 500 org.postgresql.util.PSQLException: The column index is out of range: 1, number of columns: 0.</title> </head> <body><h2>HTTP ERROR 500</h2> <p>Problem accessing /rdc. Reason: <pre> org.postgresql.util.PSQLException: The column index is out of range: 1, number of columns: 0.</pre></p><hr><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.4.z-SNAPSHOT</a><hr/> </body> </html> ** Activity (main) Pause, UserClosed = false ** By executing the Insert command directly on the database, no error occurs. Ex: insert into pessoas values ('maria', 30) - Postgresql version 11; - B4A version 8.5; - B4J version 6.8; - Server (JRDC2 and Postgresql) Windows Server 2016. P.S: Attachment file config with insert command that is running: sql.insert_people = INSERT INTO pessoas VALUES (?,?). Thanks! Attachments Image_error.JPG 107.9 KB · Views: 332 config.txt config.txt 1.3 KB · Views: 375
Hi, We are developing an app with Postgresql with JRDC2. Following the https://www.b4x.com/android/forum/t...-rdc-remote-database-connector.61801/#content post we can connect to the database and execute queries (selects). But when we run Insert, Update or Delete we get an error: ResponseError. Reason: org.postgresql.util.PSQLException: The column index is out of range: 1, number of columns: 0., Response: <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> <title>Error 500 org.postgresql.util.PSQLException: The column index is out of range: 1, number of columns: 0.</title> </head> <body><h2>HTTP ERROR 500</h2> <p>Problem accessing /rdc. Reason: <pre> org.postgresql.util.PSQLException: The column index is out of range: 1, number of columns: 0.</pre></p><hr><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.4.z-SNAPSHOT</a><hr/> </body> </html> ** Activity (main) Pause, UserClosed = false ** By executing the Insert command directly on the database, no error occurs. Ex: insert into pessoas values ('maria', 30) - Postgresql version 11; - B4A version 8.5; - B4J version 6.8; - Server (JRDC2 and Postgresql) Windows Server 2016. P.S: Attachment file config with insert command that is running: sql.insert_people = INSERT INTO pessoas VALUES (?,?). Thanks!
Erel B4X founder Staff member Licensed User Longtime User Dec 4, 2018 #2 Please post code and errors as text. Not screenshots. What do you see in the server output? Upvote 0
E Ederson Kerber Member Licensed User Dec 4, 2018 #3 Hi, Here is the Insert command used: Sub InsertRecord (nome As String, idade As Int) Dim cmd As DBCommand = CreateCommand("insert_pessoas", Array(nome, idade)) Dim j As HttpJob = CreateRequest.ExecuteBatch(Array(cmd), Null) Wait For(j) JobDone(j As HttpJob) If j.Success Then Log("Inserted successfully!") End If j.Release End Sub Erel said: What do you see in the server output? Click to expand... Sorry, how can I check this? Thanks! Upvote 0
Hi, Here is the Insert command used: Sub InsertRecord (nome As String, idade As Int) Dim cmd As DBCommand = CreateCommand("insert_pessoas", Array(nome, idade)) Dim j As HttpJob = CreateRequest.ExecuteBatch(Array(cmd), Null) Wait For(j) JobDone(j As HttpJob) If j.Success Then Log("Inserted successfully!") End If j.Release End Sub Erel said: What do you see in the server output? Click to expand... Sorry, how can I check this? Thanks!
josejad Expert Licensed User Longtime User Dec 4, 2018 #4 Use code tags to show your code. You can check the server output in the B4J log (you have to run the jRDC2 from B4J). ¿Do you have an index field in the database? I have problems too if I don't specify the fields name, because of the index field. Try Code: sql.insert_people = INSERT INTO pessoas (`nome`, `idade`) VALUES (?,?) (change `nome`, `idade` for the real database field names) Upvote 0
Use code tags to show your code. You can check the server output in the B4J log (you have to run the jRDC2 from B4J). ¿Do you have an index field in the database? I have problems too if I don't specify the fields name, because of the index field. Try Code: sql.insert_people = INSERT INTO pessoas (`nome`, `idade`) VALUES (?,?) (change `nome`, `idade` for the real database field names)
E Ederson Kerber Member Licensed User Dec 4, 2018 #5 Hi, José J. Aguilar said: ¿Do you have an index field in the database? I have problems too if I don't specify the fields name, because of the index field. Click to expand... I do not have a primary key, because a simple test table has been created. José J. Aguilar said: You can check the server output in the B4J log (you have to run the jRDC2 from B4J). Click to expand... I installed and configured B4J on the server to check the log. I reinstalled Oracle JDK 8. After this process I was able to insert normally with the command below: Code: sql.insert_pessoas=INSERT INTO pessoas VALUES(?, ?) Thanks @José J. Aguilar Problem solved! Upvote 0
Hi, José J. Aguilar said: ¿Do you have an index field in the database? I have problems too if I don't specify the fields name, because of the index field. Click to expand... I do not have a primary key, because a simple test table has been created. José J. Aguilar said: You can check the server output in the B4J log (you have to run the jRDC2 from B4J). Click to expand... I installed and configured B4J on the server to check the log. I reinstalled Oracle JDK 8. After this process I was able to insert normally with the command below: Code: sql.insert_pessoas=INSERT INTO pessoas VALUES(?, ?) Thanks @José J. Aguilar Problem solved!