Android Question [SOLVED] Invalid parameter index 1 trying to connect to JRDC2

makis_best

Well-Known Member
Licensed User
Longtime User
Hi.

I use on my JRDC2 service one query with three parameters.
B4X:
sql.Select_EGM_HEADER=SELECT ADRegistrationDate, ADCode, Status, Markup, ClientCode \
FROM EGM_HEADER where ADCode like ? AND ADRegistrationDate between ? and ? ORDER BY ADCode Desc;

So with the command I try to pass parameters like
Dim cmd As DBCommand = CreateCommand("Select_EGM_HEADER", Array("ΠΑΡ-ΠΑ00%", "2020-05-04", "2020-05-09"))

But I always get the error

ResponseError. Reason: java.sql.SQLException: Invalid parameter index 1., Response: <html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 java.sql.SQLException: Invalid parameter index 1.</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /rdc. Reason:
<pre> java.sql.SQLException: Invalid parameter index 1.</pre></p><hr><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.4.z-SNAPSHOT</a><hr/>
</body>
</html>
ERROR: <html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 java.sql.SQLException: Invalid parameter index 1.</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /rdc. Reason:
<pre> java.sql.SQLException: Invalid parameter index 1.</pre></p><hr><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.4.z-SNAPSHOT</a><hr/>
</body>
</html>

Any idea why that happening?
 

josejad

Expert
Licensed User
Longtime User
Does the sql work in your mysql manager (phpmyadmin?)

Do you get any error executing:
B4X:
SELECT ADRegistrationDate, ADCode, Status, Markup, ClientCode \
FROM EGM_HEADER where ADCode like 'ΠΑΡ-ΠΑ00%' AND ADRegistrationDate between '2020-05-04' and '2020-05-09' ORDER BY ADCode Desc;
 
Upvote 0

yfleury

Active Member
Licensed User
Longtime User
Try this
B4X:
Dim cmd As DBCommand = CreateCommand("Select_EGM_HEADER", Array as string("ΠΑΡ-ΠΑ00%", "2020-05-04", "2020-05-09"))
 
Upvote 0

makis_best

Well-Known Member
Licensed User
Longtime User
I find the problem....
The real reason was time out error.
After I increase the time waiting the problem gone.
 
Upvote 0
Top