Progress Programmer Progress Programmer - 2 months ago 14
MySQL Question

JDBC prepareStatement doesn't work

I'm trying to use the

function. The code is below. After it executes, it returns me a bunch of
strings instead of the values.

When the code finishing the
, the statement becomes:

select 'vlicense' from Vehicle

However, it needs to be:

select vlicense from Vehicle

without the quotation marks. Can anyone tell me what's the problem?

statement = oConnection.prepareStatement("select ? from Vehicle");
String tempString = "vlicense";
statement.setString(1, tempString);
resultSet = statement.executeQuery();


You can't use parameter markers for column names, table names, data type names, or basically anything that isn't data.