Android Question jRDC Error and config.properties file

Anser

Well-Known Member
Licensed User
Longtime User
Hi,

I am getting random errors from jRDC. It is directly related with the config.properties file and the format character "\" used to split the sql command lines ie to make the sql commands more readable. If I bring the sql commands to one single line then it is working as expected. Please note that, I already have many sql commands in the same config.properties file that are formatted using the "\" character and all those are working fine. Only the recently/last added commands are behaving erratically and throwing random errors OR the giving output.

I am getting the following error. From the error, I understand that it is something related to the parameter. But actually nothing wrong with the parameter.

B4X:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 500 </title>
</head>
<body>
<h2>HTTP ERROR: 500</h2>
<p>Problem accessing /rdc. Reason:
<pre>    java.sql.SQLException: Parameter index out of range (1 &gt; number of parameters, which is 0).</pre></p>
<hr /><i><small>Powered by Jetty://</small></i>
</body>
</html>
Reached JobDone
Error: java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).

Whenever I add new sql commands at the bottom in the config.properties file , I am getting these kinds of errors. That's what I understand.

Screen Snapshot of the config.properties file that throws error. (Highlighted in Yellow Color).
Error_1.png


When I modified the same sql command line, removing the line split ie "\" it started working.
No_Error.png

But I am using similar character ie "\" to split the lines and to make the sql commands in the config.properties file readable. All those are working fine in the same file.
No_Error_2.png


What could be wrong ?. Is it because the length (no of lines) of the config.properties increased beyond a point ?. The total no of lines reached a count of 197 as of now.

Prior to the error, my SQL query result set was not sorted even though I had given the ORDER BY clause in it.
B4X:
SELECT Full_Name, User_ID FROM cmn_users WHERE User_Types_ID = 7 AND App_Type_Mobile = 1 AND ACTIVE = 1 AND Comp_ID = ? ORDER BY Full_Name

After I removed the "\" character and removed all the ENTER KEY characters and brought everything to one single line, then it started working as expected.

Any idea what could be wrong ?

I use notepad to modify the config.properties file.

Thanks & Regards

Anser
 

Anser

Well-Known Member
Licensed User
Longtime User
Don't use notepad. Use a decent text editor such as Notepad++ that allows you to see the end of line characters.
I used NotePad++ to inspect whether any illegal characters are present in this file. Unfortunately, I could not find anything wrong.

On Notepad++, I switched on the following options on the Menu
View -> Show Symbol -> and I checked
"Show All Characters"
"Show Indent Guide"
"Show Wrap Symbol"

Here is the screen snapshot of config.properties file opened in Notepad++

Error_3.png


Please note that, line 202 is the last line of the file.

As I posted in the beginning of this post, the error that I get is
Error: java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is0).

If I try to make it a single line sql.command then everything works fine.

Please note that this was working fine till the entries in the config.properties file was less than 190 or so. Its only after that it started giving problems. The sql. commands given on line number 192 also had this problem, so I made it to a single line. The same issue occured with the sql. command given on line number 194 too.

Edit:
For test purpose, (on an effort to reduce the number of lines in the config.properties file), I removed some 5 to 10 lines from the config.properties file.
Tried moving this particular sq. command to the top of the config.properties file too. Unfortunately, the same result. Now really wondering what is wrong :mad:

I feel that definitely this has to do something with the character "\" and the order of ? in the sql. command in the config.properties file

Regards

Anser
 
Last edited:
Upvote 0

Anser

Well-Known Member
Licensed User
Longtime User
I know it sounds stupid, but did you try to remove the space between the "\" and the CrLf in the pink sample ?
You saved my day.

Yes, the space after the "\" character was the problem.

Lesson learned : There should be NO SPACE character after the \ character in the config.properties file. The \ character should be immediately followed by a CRLF (Linefeed). It is very difficult to notice whether there is space character after the \ with a normal text editor like Notepad.exe. I was using notepad.exe to edit config.properties file. Started using Notepad++ :)

Regards
Anser
 
Last edited:
Upvote 0
Top