-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Mark C. Roduner, Jr. wrote:
Scenario:
The current JDBC Connection is
jdbc:mysql//localhost:3306/=xql?user=root&password=myrootpass
The database `xql` contains 1 table, `settings`
Another database, `login` contains 1 table, `users`
'm' is a Matcher Object, that contains the users Name in $1, and
Domain in $2
Code: <pre>
13) String sqlString = "";
14) sqlString += "SELECT * FROM `users` WHERE `user`='" +
m.group(1);
15) sqlString += "' AND `domain`='" + m.group(2)+"' AND
`pass`=PASSWORD(" + password + ")";
16) ResultSet logins =
rootConnection.createStatement(ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY).executeQuery(sqlString);
</pre>
Error Message: General error, message from server: "Table 'xqlServer.users' doesn't exist" java.sql.SQLException: General error, message from server: "Table 'xqlServer.users' doesn't exist" at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1628) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:886) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:945) at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:917) at com.mysql.jdbc.Connection.execSQL(Connection.java:1806) at com.mysql.jdbc.Connection.execSQL(Connection.java:1740) at com.mysql.jdbc.Statement.executeQuery(Statement.java:1220) at LoginDaemon.LoginUser(LoginDaemon.java:16) at XQLServer.authLoop(XQLServer.java:103) at XQLServer.run(XQLServer.java:121) at java.lang.Thread.run(Unknown Source) Question: Seeing that my method obviously fails, is there any way to make the MySQL JDBC driver allow SQL queries to use a database other than the current one? (Other than using 'USE [DATABASE]')
Any tips or workarounds would be greatly appreciated.
Thank you in Advance: Mark C. Roduner, Jr. ([EMAIL PROTECTED])
Sure, just fully specify the table name using databasename.tablename.
-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.orgiD8DBQE+eR0VtvXNTca6JD8RAkDZAJsF/DTuud76edmiwi1GmJA/jF9L7gCfcgcb JVG/iB02RMhFVbj+cTFEoN8= =8OjB -----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
