http://developer.apple.com/internet/macosx/tomcat2.html
I've gotten to the DBtest part, but instead of successful reading from
MySQL as described, I get an exception. I've pinpointed the problem at
the line
conn = DriverManager.getConnection(DBUrl);
in the code located at...
http://developer.apple.com/internet/macosx/dbtest.java.html
I've tried everything I can think to do, including
mysql> GRANT ALL PRIVILEGES ON [dbname].* to [user]@[hostname]
identified by '[password]'
followed by FLUSH PRIVEGES
as recommended by the mm.mysql-2.0.12 JDBC driver's readme doc. Any
insight would be greatly appreciated.
I stuck a printStackTrace in the code and get a page that reads
Hi There again
retrieving data now
Caught SQL Exception: java.sql.SQLException: Server configuration denies
access to data source
java.sql.SQLException: Server configuration denies access to data source
at org.gjt.mm.mysql.MysqlIO.init(Unknown Source) at
org.gjt.mm.mysql.Connection.connectionInit(Unknown Source) at
org.gjt.mm.mysql.jdbc2.Connection.connectionInit(Unknown Source) at
org.gjt.mm.mysql.Driver.connect(Unknown Source) at
java.sql.DriverManager.getConnection(DriverManager.java:517) at
java.sql.DriverManager.getConnection(DriverManager.java:199) at
DBtest.doGet(DBtest.java:62) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applicat
ionFilterChain.java:247) at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilte
rChain.java:193) at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve
.java:243) at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.jav
a:566) at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:47
2) at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve
.java:190) at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.jav
a:566) at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.jav
a:246) at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.jav
a:564) at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:47
2) at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343
) at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
180) at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.jav
a:566) at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVal
ve.java:170) at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.jav
a:564) at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
170) at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.jav
a:564) at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.jav
a:564) at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:47
2) at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.j
ava:174) at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.jav
a:566) at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:47
2) at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.ja
va:1012) at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1
107) at java.lang.Thread.run(Thread.java:496)
I don't know if it is configured differently on OSX, but on Linux you
should check the /etc/mysql/my.cnf and make sure that any line called
"skip-networking" is commented out.
Otherwise, make sure you can connect via the command-line client. E.g.,
from a shell see if you can do:
mysql -u USERNAME -h IP_ADDRESS_OF_MACHINE -pPASSWORD DATABASE_NAME
nobody <nob...@nowhere.com> wrote:
> Caught SQL Exception: java.sql.SQLException: Server configuration denies
> access to data source
--
Marc Prud'hommeaux ma...@solarmetric.com
SolarMetric Inc. http://www.solarmetric.com
Kodo Java Data Objects Full featured JDO: eliminate the SQL from your code
> You you able to connect to your MySQL database over the network? Recent
> versions of MySQL disable networking for security reasons.
>
> I don't know if it is configured differently on OSX, but on Linux you
> should check the /etc/mysql/my.cnf and make sure that any line called
> "skip-networking" is commented out.
I've yet to find my.cnf =/
> Otherwise, make sure you can connect via the command-line client. E.g.,
> from a shell see if you can do:
>
> mysql -u USERNAME -h IP_ADDRESS_OF_MACHINE -pPASSWORD DATABASE_NAME
>
> nobody <nob...@nowhere.com> wrote:
> > Caught SQL Exception: java.sql.SQLException: Server configuration denies
> > access to data source
mysql --user=root --host=192.168.0.3 --password=myrootpass test
yields
ERROR 1130: Host '192.168.0.3' is not allowed to connect to this MySQL
server
whereas
mysql --user=root --password=myrootpass test
connects to the server where a \s gives me
Connection id: 2
Current database: test
Current user: root@localhost
Current pager: stdout
Using outfile: ''
Server version: 3.23.49-debug
Protocol version: 10
Connection: Localhost via UNIX socket
Client characterset: latin1
Server characterset: latin1
UNIX socket: /usr/local/mysql/run/mysql_socket
Uptime: 13 min 41 sec
Does that provide any insight?
Notice how the connection is through a UNIX socket?
I hope you didn't misunderstand [dbname] [user] [hostname] and [password] to
be literals?
You should do something like:
GRANT ALL PRIVILEGES ON test.* to 'root'@'192.168.0.3' identified by
'myrootpass'
-Mark
> Notice how the connection is through a UNIX socket?
>
> I hope you didn't misunderstand [dbname] [user] [hostname] and [password] to
> be literals?
>
> You should do something like:
>
> GRANT ALL PRIVILEGES ON test.* to 'root'@'192.168.0.3' identified by
> 'myrootpass'
>
> -Mark
Ahhhh HA! Found it!! What was I doing wrong you ask?? Don't laugh =)
mysql> GRANT ALL PRIVILEGES ON test.* to 'root'@'localhost' identified
by 'myrootpassword'
->FLUSH PRIVILEGES
->\g
See that \g to send the command...? Wasn't doing that. (I would have
never guessed the 'root'@'localhost' as opposed to root@localhost
without you BTW, thanks *big time*. I've been beating my head over my
CRT for just about a week now over this.) Not actually sure whether
'localhost' or '192.168.0.3' is the one that worked, did them both
before trying the code again.
So now that I have it working, it begs the question... what is the
proper way to REVOKE these privileges once I am finished testing?? And
how do I view my grant tables? [See, I have been RTFM a little ;-)]