List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:March 11 2003 9:27pm
Subject:Re: message from server: "Not unique table/alias: 'USER_ROLE'" ?
View as plain text  
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)

Thread
message from server: "Not unique table/alias: 'USER_ROLE'" ?Mufaddal Khumri11 Mar
  • Re: message from server: "Not unique table/alias: 'USER_ROLE'" ?Paul DuBois11 Mar
    • Re: message from server: "Not unique table/alias: 'USER_ROLE'" ?Mark Matthews11 Mar