From: Tom on
I have a query which concatenates a prefix in Access which works fine
in Access, but not from Java. To explain further, I create a query
programmatically which I catch when debugging, and paste it into
Access to make sure it's correct. It works fine in Access, but I get
the "too few parameters" error when executing the query from Java. By
fiddling around to figure out what it didn't like, it became evident
it was the concatenation. Has anyone run across this?
From: GArlington on
On Jul 23, 6:17 am, Tom <tew...(a)lycos.com> wrote:
> I have a query which concatenates a prefix in Access which works fine
> in Access, but not from Java. To explain further, I create a query
> programmatically which I catch when debugging, and paste it into
> Access to make sure it's correct. It works fine in Access, but I get
> the "too few parameters" error when executing the query from Java.
In my experience the above error would point to driver/settings
problem...
> By fiddling around to figure out what it didn't like, it became evident
> it was the concatenation.
Are you trying to say that "string1" + "string2" is !=
"string1string2" in your result?
> Has anyone run across this?

From: Roedy Green on
On Tue, 22 Jul 2008 22:17:57 -0700 (PDT), Tom <tewall(a)lycos.com>
wrote, quoted or indirectly quoted someone who said :

>I have a query which concatenates a prefix in Access which works fine
>in Access, but not from Java. To explain further, I create a query
>programmatically which I catch when debugging, and paste it into
>Access to make sure it's correct. It works fine in Access, but I get
>the "too few parameters" error when executing the query from Java. By
>fiddling around to figure out what it didn't like, it became evident
>it was the concatenation. Has anyone run across this?

Normally, soon after you start using your database with Java you
convert it to a true SQL engine and drop Access. There are plenty of
free ones. see http://mindprod.com/jgloss/sqlvendors.html
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
From: Sabine Dinis Blochberger on
GArlington wrote:

> On Jul 23, 6:17 am, Tom <tew...(a)lycos.com> wrote:
> > I have a query which concatenates a prefix in Access which works fine
> > in Access, but not from Java. To explain further, I create a query
> > programmatically which I catch when debugging, and paste it into
> > Access to make sure it's correct. It works fine in Access, but I get
> > the "too few parameters" error when executing the query from Java.
> In my experience the above error would point to driver/settings
> problem...
> > By fiddling around to figure out what it didn't like, it became evident
> > it was the concatenation.
> Are you trying to say that "string1" + "string2" is !=
> "string1string2" in your result?
> > Has anyone run across this?
>

I think he's saying that string concatenation to create SQL qery strings
is prone to human error.

I.e.

final String query = "select some" +
"from table "
" where some=" + value + "and forget some spaces inbetween"; [1]

<g>

[1] not valid Java nor SQL
--
Sabine Dinis Blochberger

Op3racional
www.op3racional.eu
From: David Segall on
Tom <tewall(a)lycos.com> wrote:

>I have a query which concatenates a prefix in Access which works fine
>in Access, but not from Java. To explain further, I create a query
>programmatically which I catch when debugging, and paste it into
>Access to make sure it's correct. It works fine in Access, but I get
>the "too few parameters" error when executing the query from Java. By
>fiddling around to figure out what it didn't like, it became evident
>it was the concatenation. Has anyone run across this?
"Too few parameters" indicates that you have a pre written JDBC query
that contains question marks. It is equivalent to an Access parameter
query. I suspect that you have assembled a complete SQL statement
instead of providing the required individual parameters but it would
be easier to debug if you post the code. An SSCCE
<http://homepage1.nifty.com/algafield/sscce.html> would be ideal.