-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Paul DuBois wrote:
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)

I concur with Paul (if you're code above is not a typo), the query you are executing is:


"Select * From USER_ROLE, ROLEWHERE USER_ROLE.USERID = ? And USER_ROLE.ROLEID = ROLE.ID"

-Mark

- -- MySQL 2003 Users Conference -> http://www.mysql.com/events/uc2003/

For technical support contracts, visit https://order.mysql.com/?ref=mmma

    __  ___     ___ ____  __
   /  |/  /_ __/ __/ __ \/ /  Mark Matthews <[EMAIL PROTECTED]>
  / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer - JDBC/Java
 /_/  /_/\_, /___/\___\_\___/ Flossmoor (Chicago), IL USA
        <___/ www.mysql.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.1.90 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE+bmLQtvXNTca6JD8RAg/8AJ96tufOsgzld94xsxHNSHCpaxZJrQCfQXVT
1pFZYtUmr0mFa1a0WAYOwUY=
=sUJO
-----END PGP SIGNATURE-----


--------------------------------------------------------------------- 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