You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Sandra Patricia Hunter <re...@shaw.ca> on 2003/04/01 23:54:17 UTC

JDBC-ODBC bridge error

I am using the JDBC-ODBC bridge driver during development because I don't
want to load Oracle on my system here and am using Access for now, and will
be using Oracle in the final production. I know I know: it isn't good but I
don't think it is the heart of the problem.
I don't know if that is the source of the problem but I am getting this
error message:
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
only on one page while the others using the same driver don't produce that
error. It may just be an SQL error. Here is the code snippet:
 
    String cardType = manageData.getCardType();%>
    <P> cardType: <%=cardType%></p> //this is just a debug line and produces
the required value
    <%
    String sqlString = "SELECT card_type.str_card_fields FROM card_type
WHERE (((card_type.str_card_type=cardType));";
 
    ResultSet rs = statement.executeQuery (sqlString);

RE: JDBC-ODBC bridge error

Posted by mike jackson <mj...@cdi-hq.com>.
Remember though that Oracle and Access syntax is a little different.  If
most cases it doesn't matter, but sometimes it does.  For instance, if
you're working with dates it's a little different (if you're converting
the date from a SQL date to a text date).

However, that said, here's some things to consider:

1) PreparedStatements seem to be faster for data access when you're
talking to Oracle.  I don't know why this is, but when I switched from
Statements to PreparedStatements my speed went up.  Also with
PreparedStatements you don't have to worry about cleaning the input from
users prior to putting it into the SQL (example you're looking for
"'this'", the "'" is a reserved character).

2) If you're working with Oracle they have a XSQL Servlet in the XDK.
It's faster for accessing the database than anything I've been able to
write.  However that Servlet won't talk to Access.  This is also nice
because you can setup one xsql file to get the data and several xsl
files to format it for display.

3) If your web app is updating tables in Oracle you really ought to use
stored procedures in the database.  Access stored procedures and Oracle
stored procedures aren't the same syntax wise.  And they'll probably act
differently as well.

--mikej
-=-----
mike jackson
mjackson@cdi-hq.com

-----Original Message-----
From: Sandra Patricia Hunter [mailto:redbirdofthesouth@shaw.ca] 
Sent: Tuesday, April 01, 2003 2:13 PM
To: 'Tomcat Users List'
Subject: RE: JDBC-ODBC bridge error

Thanks guys! This is what works:
String sqlString = "SELECT str_card_fields FROM card_type WHERE
str_card_type='"+cardType+"';";

Sandra Patricia Hunter
Systems Development and Web Design 
 


-----Original Message-----
From: Filip Hanik [mailto:mail@filip.net] 
Sent: April 1, 2003 2:06 PM
To: Tomcat Users List
Subject: RE: JDBC-ODBC bridge error


it is just a typo, I think what you want is this

String sqlString = "SELECT card_type.str_card_fields FROM card_type
WHERE
(((card_type.str_card_type='"+cardType+"'));";

cardType, is from you java and is a parameter

Filip

> -----Original Message-----
> From: Sandra Patricia Hunter [mailto:redbirdofthesouth@shaw.ca]
> Sent: Tuesday, April 01, 2003 1:54 PM
> To: 'Tomcat Users List'
> Subject: JDBC-ODBC bridge error
>
>
> I am using the JDBC-ODBC bridge driver during development because I 
> don't want to load Oracle on my system here and am using Access for 
> now, and will be using Oracle in the final production. I know I know: 
> it isn't good but I
> don't think it is the heart of the problem.
> I don't know if that is the source of the problem but I am getting
this
> error message:
> [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected
1.
> only on one page while the others using the same driver don't produce
that
> error. It may just be an SQL error. Here is the code snippet:
>
>     String cardType = manageData.getCardType();%>
>     <P> cardType: <%=cardType%></p> //this is just a debug line and 
> produces the required value
>     <%
>     String sqlString = "SELECT card_type.str_card_fields FROM
card_type
> WHERE (((card_type.str_card_type=cardType));";
>
>     ResultSet rs = statement.executeQuery (sqlString);
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: JDBC-ODBC bridge error

Posted by Sandra Patricia Hunter <re...@shaw.ca>.
Thanks guys! This is what works:
String sqlString = "SELECT str_card_fields FROM card_type WHERE
str_card_type='"+cardType+"';";

Sandra Patricia Hunter
Systems Development and Web Design 
 


-----Original Message-----
From: Filip Hanik [mailto:mail@filip.net] 
Sent: April 1, 2003 2:06 PM
To: Tomcat Users List
Subject: RE: JDBC-ODBC bridge error


it is just a typo, I think what you want is this

String sqlString = "SELECT card_type.str_card_fields FROM card_type  WHERE
(((card_type.str_card_type='"+cardType+"'));";

cardType, is from you java and is a parameter

Filip

> -----Original Message-----
> From: Sandra Patricia Hunter [mailto:redbirdofthesouth@shaw.ca]
> Sent: Tuesday, April 01, 2003 1:54 PM
> To: 'Tomcat Users List'
> Subject: JDBC-ODBC bridge error
>
>
> I am using the JDBC-ODBC bridge driver during development because I 
> don't want to load Oracle on my system here and am using Access for 
> now, and will be using Oracle in the final production. I know I know: 
> it isn't good but I
> don't think it is the heart of the problem.
> I don't know if that is the source of the problem but I am getting this
> error message:
> [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
> only on one page while the others using the same driver don't produce that
> error. It may just be an SQL error. Here is the code snippet:
>
>     String cardType = manageData.getCardType();%>
>     <P> cardType: <%=cardType%></p> //this is just a debug line and 
> produces the required value
>     <%
>     String sqlString = "SELECT card_type.str_card_fields FROM card_type
> WHERE (((card_type.str_card_type=cardType));";
>
>     ResultSet rs = statement.executeQuery (sqlString);
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: JDBC-ODBC bridge error

Posted by Filip Hanik <ma...@filip.net>.
it is just a typo, I think what you want is this

String sqlString = "SELECT card_type.str_card_fields FROM card_type  WHERE
(((card_type.str_card_type='"+cardType+"'));";

cardType, is from you java and is a parameter

Filip

> -----Original Message-----
> From: Sandra Patricia Hunter [mailto:redbirdofthesouth@shaw.ca]
> Sent: Tuesday, April 01, 2003 1:54 PM
> To: 'Tomcat Users List'
> Subject: JDBC-ODBC bridge error
>
>
> I am using the JDBC-ODBC bridge driver during development because I don't
> want to load Oracle on my system here and am using Access for
> now, and will
> be using Oracle in the final production. I know I know: it isn't
> good but I
> don't think it is the heart of the problem.
> I don't know if that is the source of the problem but I am getting this
> error message:
> [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
> only on one page while the others using the same driver don't produce that
> error. It may just be an SQL error. Here is the code snippet:
>
>     String cardType = manageData.getCardType();%>
>     <P> cardType: <%=cardType%></p> //this is just a debug line
> and produces
> the required value
>     <%
>     String sqlString = "SELECT card_type.str_card_fields FROM card_type
> WHERE (((card_type.str_card_type=cardType));";
>
>     ResultSet rs = statement.executeQuery (sqlString);
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: JDBC-ODBC bridge error

Posted by Jan Behrens <ja...@diekleinedomain.de>.
Hi Sandra,

>     String sqlString = "SELECT card_type.str_card_fields FROM card_type
> WHERE (((card_type.str_card_type=cardType));";

you are using 3 opening brackets and only 2 closing ones in your where
condition. IMHO it would be correct SQL to write:
"SELECT card_type.str_card_fields FROM card_type WHERE
card_type.str_card_type=cardType;" instead, no need for brackets there.

Regards Jan



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org