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