Re: Two of three SQL stmts execute: third results in table does not exist exception
- From: David Harper <devnull@xxxxxxxxxxxxxxxxxxx>
- Date: Fri, 16 Mar 2007 07:09:04 GMT
GGP wrote:
I attempt to collect data from a database three times in one method,[SNIP]
all using one connection. The first two queries execute without any
problem. However, the third fires an sql exception:
java.sql.SQLSyntaxErrorException: Table/View 'TABLENAME' does not
exist.
I connect to the database using a connection class, as follows:
ResultSet rs3 = null;[SNIP]
Statement stmt3 = null;
stmt3 = con.createStatement();
String sqlListData = "select " + unitID + ", " + unitName + "
from " + tableName;
rs3 = stmt3.executeQuery(sqlListData); //This is where the
error occurs. All the strings in stmt3 are fine (correct spelling,
etc.)
Any ideas? I really appreciate the help.
You do not show us how the variable "tableName" has been defined, so it is almost impossible to offer advice.
However, I'm guessing that somewhere in your code, you have set
String tableName = "TABLENAME";
Perhaps you intended to set the correct value elsewhere in your code, but you forgot to do so. Since we can't see the rest of your class definition, it's impossible to say for sure.
David Harper
Cambridge, England
.
- Follow-Ups:
- References:
- Prev by Date: Two of three SQL stmts execute: third results in table does not exist exception
- Next by Date: HSQLDB Lock files
- Previous by thread: Two of three SQL stmts execute: third results in table does not exist exception
- Next by thread: Re: Two of three SQL stmts execute: third results in table does not exist exception
- Index(es):
Relevant Pages
|
|