At 12:50 +0530 3/11/03, Mufaddal Khumri wrote:
What does the error mean ? - message from server: "Not unique table/alias: 'USER_ROLE'"

This happens when I try to use the java code:

PreparedStatement pstmt = con.prepareStatement("Select * From USER_ROLE, ROLE" +
"WHERE USER_ROLE.USERID = ? And USER_ROLE.ROLEID = ROLE.ID");


pstmt.setInt(1, id);
ResultSet rs = pstmt.executeQuery();

If i execute the same query at mysql prompt, it works perfectly fine as is. Is their a problem with the JDBC driver ?

When you execute the query at the mysql prompt, you're probably providing the required space between ROLE and WHERE. The query shown above appears to have no such space, which somewhat changes the semantics of the query.


Thanks.


The error thrown is:

java.sql.SQLException: Invalid argument value, message from server: "Not unique table/alias: 'USER_ROLE'"
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1613)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:880)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:939)
at com.mysql.jdbc.Connection.execSQL(Connection.java:1780)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1439)


---------------------------------------------------------------------
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



Reply via email to