Connection con =
DriverManager.getConnection("jdbc:mysql://localhost/someDB?user=jed");
and I get this error:
java.sql.SQLException: Cannot load connection class
'java.sql.SQLException: Server configuration denies access to data
source'.
but from the prompt this works fine:
mysql -u jed someDB
What could I be doing wrong?
Thanks,
Jed McCaleb
swa...@yahoo.com
Jed McCaleb schrieb:
> Hello I'm tring to connect to a MySQL database. I'm using the mm.MySQL
> driver and running everthing on a Linux box.
> I do the following:
>
> Connection con =
> DriverManager.getConnection("jdbc:mysql://localhost/someDB?user=jed");
>
did you load the driver before you use it?
please post the complete code-snippet!
--
cu, Roger
*** ros...@informatik.tu-muenchen.de ***
http://www.friendscape.com : roger
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
Rosette <ros...@in.tum.de> wrote in message
news:392AC04A...@in.tum.de...
Jed McCaleb wrote:
> Hello I'm tring to connect to a MySQL database. I'm using the mm.MySQL
> driver and running everthing on a Linux box.
> I do the following:
>
> Connection con =
> DriverManager.getConnection("jdbc:mysql://localhost/someDB?user=jed");
>
> and I get this error:
>
> java.sql.SQLException: Cannot load connection class
> 'java.sql.SQLException: Server configuration denies access to data
> source'.
>
> but from the prompt this works fine:
>
> mysql -u jed someDB
>
> What could I be doing wrong?
> Thanks,
> Jed McCaleb
> swa...@yahoo.com
--
*****************************
Daqing Li
126-01 Marshall Dr.
W. Lafayette, IN47906
Tel: (765) 4964534 (home)
(765) 4942146 (office)
Email: l...@ecn.purdue.edu
*****************************
> Hello I'm tring to connect to a MySQL database. I'm using the mm.MySQL
> driver and running everthing on a Linux box.
> I do the following:
>
> Connection con =
> DriverManager.getConnection("jdbc:mysql://localhost/someDB?user=jed");
>
> and I get this error:
>
> java.sql.SQLException: Cannot load connection class
> 'java.sql.SQLException: Server configuration denies access to data
> source'.
>
> but from the prompt this works fine:
>
> mysql -u jed someDB
>
type
mysql -u root -p mysql
enter your mysql root password
then check out the security configuration in host, user, db tables.
SELECT * FROM host;
SELECT * FROM user;
SELECT * FROM db;
See very good site for MySQL DBA
http://www.devshed.com/Server_Side/MySQL/Administration/
after you done the security configuration
exit
and type
mysqladmin -u root -p reload
enter your mysql root password
--
Why we want to teach our babies to talk and walk,
then later we tell them "sit down!", "be quiet!" ?
Democracy is not a better way for a solution,
it is just another way to spread the blames.
--Raymond
Raymond Chui wrote:
--
Connection SQLConn =
DriverManager.getConnection("jdbc:mysql://mysqlmachinename/mysqldatabasename
", "username", "plaintextpassword");
I can't say that I am really fond of having a password buried in the code so
I had to create a special read-only user and some other manipulations but
this seems to have worked out well. Bear in mind that mysql will process
this as username@machinename so if you have multiple accounts setup, some
with or without the machinename or ip address, and some with or without a
password for the same username, then there are some specific semantics as to
which entry mysql will process it as.
Hope this helps.
Chris
spam.chr...@opb.msu.edu.spam
(drop the spam if you wish to contact me)
"Li Daqing" <l...@ecn.purdue.edu> wrote in message
news:392B42DE...@ecn.purdue.edu...
> I have the same problem as you but after I change the localhost with my IP
> address I do make a successful connection with a null password. My problem
> is I never can make a connection which requires a password by using a
> mm.mysql.jdbc driver. Anyone has any suggestions?
>
> Jed McCaleb wrote:
>
> > Hello I'm tring to connect to a MySQL database. I'm using the mm.MySQL
> > driver and running everthing on a Linux box.
> > I do the following:
> >
> > Connection con =
> > DriverManager.getConnection("jdbc:mysql://localhost/someDB?user=jed");
> >
> > and I get this error:
> >
> > java.sql.SQLException: Cannot load connection class
> > 'java.sql.SQLException: Server configuration denies access to data
> > source'.
> >
> > but from the prompt this works fine:
> >
> > mysql -u jed someDB
> >
> > What could I be doing wrong?
> > Thanks,
> > Jed McCaleb
> > swa...@yahoo.com
>
I am having a similar problem, however I have tried localhost,
localhost.localdomain,
and 127.0.0.1
all of them give the following or similar message:
[root@localhost JDBC]# java SimpleQuery
Registering org.gjt.mm.mysql.Driver
Connecting to jdbc:mysql://127.0.0.1/BryceData
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:301)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:121)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:108)
at java.net.Socket.<init>(Socket.java:265)
at java.net.Socket.<init>(Socket.java:94)
at org.gjt.mm.mysql.MysqlIO.<init>(MysqlIO.java:114)
at org.gjt.mm.mysql.Connection.<init>(Connection.java:229)
at org.gjt.mm.mysql.Driver.connect(Driver.java:126)
at java.sql.DriverManager.getConnection(DriverManager.java:453)
at java.sql.DriverManager.getConnection(DriverManager.java:155)
at SimpleQuery.performQuery(SimpleQuery.java:80)
at SimpleQuery.main(SimpleQuery.java:39)
java.sql.SQLException: Cannot connect to MySQL server on 127.0.0.1:3306. Is
there a MySQL server running on the machine/port you are trying to connect to?
(java.net.ConnectException)
at org.gjt.mm.mysql.Connection.<init>(Connection.java:239)
at org.gjt.mm.mysql.Driver.connect(Driver.java:126)
at java.sql.DriverManager.getConnection(DriverManager.java:453)
at java.sql.DriverManager.getConnection(DriverManager.java:155)
at SimpleQuery.performQuery(SimpleQuery.java:80)
at SimpleQuery.main(SimpleQuery.java:39)
[root@localhost JDBC]#
Does anyone have any Ideas?
I think that there is a MySQL server running, because I can get the tables
with
mysql.
Plus my processes ps -A shows three mysqld processes.
Thankyou
Bryce Alcock
Li Daqing wrote:
> I checked the problem. It seems that when I am using localhost in my Java
> program to connect the MySQL database, the error message indicate that I am
> using localhost.localdomain to connect the server. So when I changed the
> localhost in user table into localhost.localdomain, I can connect to MySQL
> server successfully. But it still leave a question where the localhost is
> changed into localhost.localdomain. I checked the source file of mm.mysql
> jdbc driver, it seems no file contains a "localdomain" string. I don't know
> who has any idea on this.
>
> Raymond Chui wrote:
>
> > Jed McCaleb wrote:
> >
> > > Hello I'm tring to connect to a MySQL database. I'm using the mm.MySQL
> > > driver and running everthing on a Linux box.
> > > I do the following:
> > >
> > > Connection con =
> > > DriverManager.getConnection("jdbc:mysql://localhost/someDB?user=jed");
> > >
> > > and I get this error:
> > >
> > > java.sql.SQLException: Cannot load connection class
> > > 'java.sql.SQLException: Server configuration denies access to data
> > > source'.
> > >
> > > but from the prompt this works fine:
> > >
> > > mysql -u jed someDB
> > >
> >
> > type
> >
> > mysql -u root -p mysql
> > enter your mysql root password
> >
> > then check out the security configuration in host, user, db tables.
> > SELECT * FROM host;
> > SELECT * FROM user;
> > SELECT * FROM db;
> >
> > See very good site for MySQL DBA
> > http://www.devshed.com/Server_Side/MySQL/Administration/
> >
> > after you done the security configuration
> > exit
> > and type
> > mysqladmin -u root -p reload
> > enter your mysql root password
> >
> > --
> > Why we want to teach our babies to talk and walk,
> > then later we tell them "sit down!", "be quiet!" ?
> >
> > Democracy is not a better way for a solution,
> > it is just another way to spread the blames.
> >
> > --Raymond
>
--
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS d- s+:+ a- C++++(++++) USU++++ P+ L++++ E--- W++++ N+++ w---
O- M- V-- PS PE++ Y-- PGP++ t+ 5-- X++ R tv- b++++ DI+++ D++
G++ e+++ h++
------END GEEK CODE BLOCK------
AKS wrote:
------
Posted via news://freenews.netfront.net
Complaints to ne...@netfront.net