List:MySQL and Java« Previous MessageNext Message »
From:Bryan Bateman Date:August 30 2002 1:09pm
Subject:Re: cannot connect to mysql server
View as plain text  
I too was having problems connecting to a remote host.  I loaded MySQL on
the same machine and had no problems. Is there a limitation to the driver
that only lets it connect via localhost?  I noticed that,  no matter what I
designated as a host in my url, the error message always refered to
localhost.

----- Original Message -----
From: "matthew yee-king" <yeeking@stripped>
To: <java@stripped>
Sent: Friday, August 30, 2002 7:21 AM
Subject: Re: cannot connect to mysql server


> I now know that its definitely a problem with my mysql server setup.
>
> I can connect to a remote server with the java code below  just fine.
>
> Any ideas why i've got command line mysql access and php mysql access, but
not java?
>
> Some debian mysql issue?
>
> cheers
>
> matthew
>
> On Fri, 30 Aug 2002 11:53:43 +0100
> matthew yee-king <yeeking@stripped> wrote:
>
> > I'm sure this ones appeared many times before, but the mailing list
archive doesn't appear to be searchable.
> >
> > (am i wrong - is there a url where i can search the mailng list? )
> >
> > Having problems connecting to my mysql server.
> >
> >  running
> >
> > $ java -version
> > java version "1.3.1"
> > Java(TM) 2 Runtime Environment, Standard Edition (build
Blackdown-1.3.1-02b-FCS)
> > Java HotSpot(TM) Client VM (build Blackdown-1.3.1_02b-FCS, mixed mode)
> >
> > mysql  Ver 11.16 Distrib 3.23.49, for pc-linux-gnu (i686)
> >
> > Driver.java,v 1.3 2002/05/16 20:30:57
> >
> > on debian woody/ testing (using the mysql-server available as a .deb )
> >
> > - i can connect fine using command line client. (e.g. mysql -u
<username> -h localhost -P 3306 -p
> > - i can connect fine using php scripts
> > - i can't connect using a java program:
> >
> > - running this code:
> >
> >    Class.forName("com.mysql.jdbc.Driver").newInstance();
> >    Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/", "<username>",
"<password>");
> > -or-
> >   Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/test",
"<username>", "<password>");
> >
> > - i get this error:
> >
> > java.sql.SQLException: Cannot connect to MySQL server on localhost:3306.
Is there a MySQL server running on the machine/port you are trying to
connect to? (java.net.ConnectException)
> >
> > can anybody help me?
> >
> > cheers
> >
> > matthew
> >
> > ---------------------------------------------------------------------
> > Please check "http://www.mysql.com/Manual_chapter/manual_toc.html"
before
> > posting. To request this thread, e-mail java-thread4226@stripped
> >
> > To unsubscribe, send a message to the address shown in the
> > List-Unsubscribe header of this message. If you cannot see it,
> > e-mail java-unsubscribe@stripped instead.
>
> ---------------------------------------------------------------------
> Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
> posting. To request this thread, e-mail java-thread4228@stripped
>
> To unsubscribe, send a message to the address shown in the
> List-Unsubscribe header of this message. If you cannot see it,
> e-mail java-unsubscribe@stripped instead.
>


Thread
cannot connect to mysql servermatthew yee-king30 Aug
  • Re: cannot connect to mysql servermatthew yee-king30 Aug
    • Re: cannot connect to mysql servermatthew yee-king30 Aug
  • Re: cannot connect to mysql serverBryan Bateman30 Aug
  • Re: cannot connect to mysql serverPeter T. Abplanalp30 Aug
    • Re: cannot connect to mysql servermatthew yee-king30 Aug
      • Re: cannot connect to mysql serverPeter T. Abplanalp30 Aug