Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JSP.SQL and Tomcat

Status
Not open for further replies.

Bebacha

Programmer
Mar 30, 2003
3
PH
What is wrong with this piece of code?

String cardType = manageData.getCardType();%>
<P> cardType: <%=cardType%></p>

<%
String sqlString = &quot;SELECT card_type.str_card_fields FROM card_type WHERE(((card_type.str_card_type)=cardType));&quot;;

It is returning this error in the Tomcat window:
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

I am using the JDBC-ODBC bridge for prototype convenience and will switch to a proper JDBC driver later, but switching right now is not an option. I have several pages all using the same driver with no difficulty. Only this page is causing issues.
 
String sqlString = &quot;SELECT card_type.str_card_fields FROM card_type WHERE(((card_type.str_card_type)='&quot; + cardType + &quot;'))&quot;;

This is more of a Jsp question then SQL so posting in this forum is a wee bit inapropriate.

(You should also look out for SQL injection. I.e. you need to replace any ' in the cardType variable with '')
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top