Hi :) Many thanks to those who sent a reply.

I figured out a workaround for my problem.

Here's the part where I get the value of the parameter passed (the table i'd like to 
query)

String tab_name = "default_table";

if (req.getParameter("tab1") != null) {
tab_name = req.getParameter("tab1").toUpperCase();
}

String q = "SELECT * from " +tab_name + "";
pstmt = conn.prepareStatement(q);
rset = pstmt.executeQuery();



>Fengrui wrote

>I can not see any reason to use ? for table name

I wanted to create a generic servlet that would query table X based on the valued 
being passed to the servlet.


> Tom Kochanowicz wrote

>It looks like you are using "name_of_table" where it should be the
>"column_name_of_table"

"name_of_table" was just a variable name I chose at random, it held no real 
signifigance. :)


My question now is, should I even bother using a PrepearedStatement for the case in 
hand? A 'Statement' could produce the same results. Or is it better practice to use 
PreparedStatements(i.e benefits of a precomipled SQL statement, greater functionality 
should I choose to enhance my code)???

Tia,

-Robert-

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to