Cannot connect to MySql Database

2013-04-09 Thread Joe Kosinski
Hi,

I am trying to connect to a MySql database and I keep getting the following:

Cannot find (ping) database host Joseph-Kosinskis-MacBook on the network
Failed to connect to Unix socket '/var/run/lirc/lircd'
No such file or directory (2)

The database is located on a MacBook running OS X 10.8.  The MySql Server is 
running.

Joe
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: Cannot connect to MySql Database

2013-04-09 Thread Stillman, Benjamin

On 4/9/13 1:54 PM, Joe Kosinski joj...@gmail.com wrote:

Hi,

I am trying to connect to a MySql database and I keep getting the
following:

   Cannot find (ping) database host Joseph-Kosinskis-MacBook on the network
   Failed to connect to Unix socket '/var/run/lirc/lircd'
   No such file or directory (2)

The database is located on a MacBook running OS X 10.8.  The MySql Server
is running.

Joe
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql





The hostname can't be found. Try localhost instead of
Joseph-Kosinskis-MacBook.

As for the next error, that's not a database error, that's a MythTV error.

lircd is the daemon for remotes (Linux Infrared Remote Control Daemon).








Notice: This communication may contain privileged and/or confidential 
information. If you are not the intended recipient, please notify the sender by 
email, and immediately delete the message and any attachments without copying 
or disclosing them. LBI may, for any reason, intercept, access, use, and 
disclose any information that is communicated by or through, or which is stored 
on, its networks, applications, services, and devices.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: cannot connect to mysql

2006-01-10 Thread Gleb Paharenko
Hello.



See:

  http://dev.mysql.com/doc/refman/5.0/en/error-access-denied.html





ghislain groulx wrote:

 im quite new to mysql and here is the problem.  I simply cannot connect

 to mysql through phpmyadmin or anything else.  Lets say i enter the url

 to connect (localhost/phpmyadmin/index.html) i end up in the welcome

 page but it says access denied for user [EMAIL PROTECTED] (using

 password: NO)

 

 when i do the phpinfo test, everything seems to be ok with the server (i

 run apache) and mysql and php are installed and running, but i simply

 cannot connect.  i guess the problem is the username and password or

 something like in the configuration of mysql that but i cant figure it

 out. Can someone tell me what i am missing ?

 

 thanks a lot !!

 

 

 



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Gleb Paharenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.NET
   ___/   www.mysql.com




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



cannot connect to mysql

2006-01-09 Thread ghislain groulx
im quite new to mysql and here is the problem.  I simply cannot connect to 
mysql through phpmyadmin or anything else.  Lets say i enter the url to 
connect (localhost/phpmyadmin/index.html) i end up in the welcome page but 
it says access denied for user [EMAIL PROTECTED] (using password: NO)


when i do the phpinfo test, everything seems to be ok with the server (i run 
apache) and mysql and php are installed and running, but i simply cannot 
connect.  i guess the problem is the username and password or something like 
in the configuration of mysql that but i cant figure it out. Can someone 
tell me what i am missing ?


thanks a lot !!



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Cannot connect to mysql through network while unix socket works

2004-12-23 Thread Oscar
N,jjkj{zwkozz
xjDear all,

I have a mysql-4.0.12 server installed on RH 8, it works fine for months before 
I
find the server unavailable from the remote host on the same LAN. I am sure 
there
isn't any firewall between server and client. I ssh to the server and find the 
mysqld
is running and functional, because I can connect to it via unix socket!!!

Things not changed event restart the mysql service, so I have to reboot the 
server :(

Anybody here has the same experience, and how this happened?

Oscar Yen.



cannot connect to mysql server

2003-04-05 Thread Peter Gumbrell
I have installed mysql on Mac OS X. when I attempt to access it either 
through a php page or through Terminal, I receive this message;

Can't connect to local MySQL server through socket '/tmp/mysql.sock'

I have just switched to a Mac and am unfamiliar with many aspects of 
unix. I read something about creating a symbolic link but am unsure how 
to do this and if this will solve the problem.

Any help would be greatly appreciated.

Peter

[EMAIL PROTECTED]






Re: cannot connect to mysql server

2003-04-05 Thread Jeff Shapiro
At 12:00 -0500 4/5/03, Peter Gumbrell wrote:
I have installed mysql on Mac OS X. when I attempt to access it 
either through a php page or through Terminal, I receive this 
message;

Can't connect to local MySQL server through socket '/tmp/mysql.sock'
mysqld isn't running.

You can check to see if it is running with (run this in a terminal window):

cd /usr/local/mysql

./bin/mysqlamdin ping

to start mysqld use:

 shell bin/safe_mysqld --user=mysql 
 or
 shell bin/mysqld_safe --user=mysql 
 if you are running MySQL 4.x
--user=msyql should be the user that you set up to own the msql directories.

I have just switched to a Mac and am unfamiliar with many aspects of 
unix. I read something about creating a symbolic link but am unsure 
how to do this and if this will solve the problem.

Any help would be greatly appreciated.

Peter

[EMAIL PROTECTED]
--

Jeff Shapiro, Colorado Springs, CO, USA

At work I *have* to use a Windows machine, at home I *get* to use a Mac.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: cannot connect to mysql server

2003-04-05 Thread Todd O'Bryan
Try the following

cd /usr/local/mysql
./bin/mysqld_safe
and see if that starts up the server.

If it doesn't, check to make sure you don't have a proxy set in your 
internet configurations.

Todd

On Saturday, April 5, 2003, at 12:00  PM, Peter Gumbrell wrote:

I have installed mysql on Mac OS X. when I attempt to access it either 
through a php page or through Terminal, I receive this message;

Can't connect to local MySQL server through socket '/tmp/mysql.sock'

I have just switched to a Mac and am unfamiliar with many aspects of 
unix. I read something about creating a symbolic link but am unsure 
how to do this and if this will solve the problem.

Any help would be greatly appreciated.

Peter

[EMAIL PROTECTED]






--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Cannot connect to mysql server

2003-03-29 Thread Reuben D. Budiardja

Hello,
I have an interesting problem. I installed mysql client and server from Redhat 
7.3 RPM. Then I set up a username and password for a user monty (to use 
example from the manual).

Then I grant priveleges for the user with:

mysql GRANT ALL PRIVILEGES ON *.* TO [EMAIL PROTECTED]
- IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
mysql GRANT ALL PRIVILEGES ON *.* TO monty@%
- IDENTIFIED BY 'some_pass' WITH GRANT OPTION;

and restarted mysql server. Let's assume the server name is sql.domain.edu

I then tried to connect to the server as user monty from localhost:
$ mysql -u monty -p

and then tried it from another machine console:
$ mysql -u monty -h sql.domain.edu -p

and all is well.

But when i tried to connect using the console from localhost (ie. 
sql.domain.edu) by specifiying hostname:
$ mysql -u monty -h sql.domain.edu -p

I got the cannot connect user [EMAIL PROTECTED] error message. Why does 
this happen?

I fixed this by doing
mysql GRANT ALL PRIVILEGES ON *.* TO [EMAIL PROTECTED]
- IDENTIFIED BY 'some_pass' WITH GRANT OPTION;

but I thought I already specified the wildcard on my previous grant previlege 
so that monty can access from *any* machine. Just curious as t why this 
happens, can  anyone help?

Thanks a lot.
Reuben D. Budiardja


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



cannot connect to MySQL

2003-03-14 Thread Jon Miller
I'm having a problem connecting to MySQL database using phpMyAdmin from
a remote location.  I've had a look at the manual but I'm not too clear
on what has to be done.  I see that the connection is through a socket. 
Can I change this to connect using an ip connection? Reason I ask is
because the MySQL server actually sits behind a firewall (iptables
Forward rule) and I have the port 3306 opened and forwarding packets (at
least I think I do) to the SQL server. The following error is what I
get:

--Warning: Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock' (2) in /var/www/html/phpMyAdmin/lib.inc.php3
on line 255

Warning: MySQL Connection Failed: Can't connect to local MySQL server
through socket '/var/lib/mysql/mysql.sock' (2) in
/var/www/html/phpMyAdmin/lib.inc.php3 on line 255
Error 

MySQL said: Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock' (2)


 
Jon Miller [EMAIL PROTECTED]
MMT Networks Pty Ltd



-
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



Re: cannot connect to MySQL

2003-03-14 Thread gerald_clark
Please read the warning.
It attempting a LOCAL connection.
Please enter the host ( server) you wish to connect to.
Jon Miller wrote:

I'm having a problem connecting to MySQL database using phpMyAdmin from
a remote location.  I've had a look at the manual but I'm not too clear
on what has to be done.  I see that the connection is through a socket. 
Can I change this to connect using an ip connection? Reason I ask is
because the MySQL server actually sits behind a firewall (iptables
Forward rule) and I have the port 3306 opened and forwarding packets (at
least I think I do) to the SQL server. The following error is what I
get:

--Warning: Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock' (2) in /var/www/html/phpMyAdmin/lib.inc.php3
on line 255
Warning: MySQL Connection Failed: Can't connect to local MySQL server
through socket '/var/lib/mysql/mysql.sock' (2) in
/var/www/html/phpMyAdmin/lib.inc.php3 on line 255
Error 

MySQL said: Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock' (2)


Jon Miller [EMAIL PROTECTED]
MMT Networks Pty Ltd


-
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
 



-
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


HELP: cannot connect to MySQL server

2002-02-14 Thread wally liau

Dear MySql experts: 

we have mysql and mm driver installed on a unix
server, but when I try to run Blob (in testsuite/), it
gives error message: 

cannot connect to MySQL server on //localhost:3306

here is the code for connection: 

try {
Class.forName(org.gjt.mm.mysql.Driver).newInstance();
Connection conn =
DriverManager.getConnection(jdbc:mysql://localhost:3306/test?user=testpassword=test);
...

}
our system admininstor doesn't seem to know what's
going wrong (that's why I'm looking for help from
mysql community). 

Any info would be appreciated. 






__
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

-
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




Re: HELP: cannot connect to MySQL server

2002-02-14 Thread Brian Reichert

On Thu, Feb 14, 2002 at 03:41:32PM -0800, wally liau wrote:
 Dear MySql experts: 
 
 we have mysql and mm driver installed on a unix
 server, but when I try to run Blob (in testsuite/), it
 gives error message: 
 
 cannot connect to MySQL server on //localhost:3306

Can you, at this point, connect to the server via the 'mysql' binary?

- Is there a server running on this machine?

- Is there a server running on this machine at port 3306?

- Is there a server running on this machine at port 3306 that lets
  user 'test' coonect with the password 'test'?

 our system admininstor doesn't seem to know what's
 going wrong (that's why I'm looking for help from
 mysql community). 

I'm sorry. :/

-- 
Brian 'you Bastard' Reichert[EMAIL PROTECTED]
37 Crystal Ave. #303Daytime number: (603) 434-6842
Derry NH 03038-1713 USA Intel architecture: the left-hand path

-
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




RE: Cannot connect to MySQL server with a java application

2002-02-12 Thread Lee, Andrew

Almost, but not exactly the same .

DriverManager.getConnection(dburl, dbuser, dbpasswd) -- note, 3 arguments
here

 -Original Message-
 From: debian [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, February 06, 2002 1:59 PM
 To:   [EMAIL PROTECTED]
 Subject:  Cannot connect to MySQL server with a java application
 
 hello,
 
 i tried to connect my MySQL-Server with a short java application. The
 application can't connect to the server, obviously the server is running
 on
 localhost:3306. I append the SourceCode (roughly the same:
 http://lists.mysql.com/cgi-ez/ezmlm-cgi?1:mss:80228:200107:popciohjmlbbolp
 ak
 ) and the error-message.
 
 SourceCode:
 import java.sql.*;
 
 class SQLtest2
 {
 public static void main(String[] args)
 {
 try
   {
Class.forName(org.gjt.mm.mysql.Driver).newInstance();
System.out.println(register the Driver: OK);
   }
   catch (Exception e){}
   try
   {
Connection conn =
 DriverManager.getConnection(jdbc:mysql://127.0.0.1:3306/test?user=testpa
 ss
 word=teschd);
   System.out.println(... ccnnected);
   Statement s = conn.createStatement();
s.close();
   conn.close();
   }
   catch(SQLException e)
   {
   System.out.println(SQLException:  + e.getMessage());
System.out.println(SQLState:  + e.getSQLState());
   System.out.println(VendorError:  + e.getErrorCode());
   }
 
 }
 }
 
 Error-Msg:
 
 register the Driver: OK
 java.io.IOException: Connection timed out
 at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:56)
 (some EXCeptions more)
 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.io.IOException)
 SQLState: 08S01
 VendorError: 0
 
 is there somebody who can help me?
 
 thnx bobby
 

-
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


-
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




Re: Cannot connect to MySQL server with a java application

2002-02-12 Thread Mark Matthews

It seems that either your server was started with the --skip-networking
flag, or that it's not listening on port 3306 (check your my.cnf), or your
machine has a firewall installed locally that doesn't allow network
connections to port 3306.

The MySQL command-line client will probably work in any of these cases, as
it uses Unix domain sockets, which are really filesystem-based. You should
read the MySQL manual's installation section and use what you learn there to
figure out how your mysqld is configured. You won't be able to connect to it
using JDBC until you know for a fact that it is allowing TCP/IP connections,
what port you should connect on (3306 by default), and that you don't have
anything on your machine that prevents you from connecting to that port.



-Mark



- Original Message -

From: Lee, Andrew [EMAIL PROTECTED]

To: 'debian' [EMAIL PROTECTED]; [EMAIL PROTECTED]

Sent: Wednesday, February 06, 2002 8:23 PM

Subject: RE: Cannot connect to MySQL server with a java application



 Almost, but not exactly the same .



 DriverManager.getConnection(dburl, dbuser, dbpasswd) -- note, 3 arguments

 here



  -Original Message-

  From: debian [SMTP:[EMAIL PROTECTED]]

  Sent: Wednesday, February 06, 2002 1:59 PM

  To: [EMAIL PROTECTED]

  Subject: Cannot connect to MySQL server with a java application

 

  hello,

 

  i tried to connect my MySQL-Server with a short java application. The

  application can't connect to the server, obviously the server is running

  on

  localhost:3306. I append the SourceCode (roughly the same:

 

http://lists.mysql.com/cgi-ez/ezmlm-cgi?1:mss:80228:200107:popciohjmlbbolp

  ak

  ) and the error-message.

 

  SourceCode:

  import java.sql.*;

 

  class SQLtest2

  {

  public static void main(String[] args)

  {

  try

  {

  Class.forName(org.gjt.mm.mysql.Driver).newInstance();

  System.out.println(register the Driver: OK);

  }

  catch (Exception e){}

  try

  {

  Connection conn =

 

DriverManager.getConnection(jdbc:mysql://127.0.0.1:3306/test?user=testpa

  ss

  word=teschd);

  System.out.println(... ccnnected);

  Statement s = conn.createStatement();

  s.close();

  conn.close();

  }

  catch(SQLException e)

  {

  System.out.println(SQLException:  + e.getMessage());

  System.out.println(SQLState:  + e.getSQLState());

  System.out.println(VendorError:  + e.getErrorCode());

  }

 

  }

  }

 

  Error-Msg:

 

  register the Driver: OK

  java.io.IOException: Connection timed out

  at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:56)

  (some EXCeptions more)

  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.io.IOException)

  SQLState: 08S01

  VendorError: 0

 

  is there somebody who can help me?

 

  thnx bobby

 



-
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


-
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




Cannot connect to MySQL server with a java application

2002-02-11 Thread debian

hello,

i tried to connect my MySQL-Server with a short java application. The
application can't connect to the server, obviously the server is running on
localhost:3306. I append the SourceCode (roughly the same:
http://lists.mysql.com/cgi-ez/ezmlm-cgi?1:mss:80228:200107:popciohjmlbbolpak
) and the error-message.

SourceCode:
import java.sql.*;

class SQLtest2
{
public static void main(String[] args)
{
try
  {
   Class.forName(org.gjt.mm.mysql.Driver).newInstance();
   System.out.println(register the Driver: OK);
  }
  catch (Exception e){}
  try
  {
   Connection conn =
DriverManager.getConnection(jdbc:mysql://127.0.0.1:3306/test?user=testpass
word=teschd);
  System.out.println(... ccnnected);
  Statement s = conn.createStatement();
   s.close();
  conn.close();
  }
  catch(SQLException e)
  {
  System.out.println(SQLException:  + e.getMessage());
   System.out.println(SQLState:  + e.getSQLState());
  System.out.println(VendorError:  + e.getErrorCode());
  }

}
}

Error-Msg:

register the Driver: OK
java.io.IOException: Connection timed out
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:56)
(some EXCeptions more)
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.io.IOException)
SQLState: 08S01
VendorError: 0

is there somebody who can help me?

thnx bobby


-
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


-
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




Re: Cannot connect to MySQL server with a java application

2002-02-07 Thread Mark Matthews

It seems that either your server was started with the --skip-networking
flag, or that it's not listening on port 3306 (check your my.cnf), or your
machine has a firewall installed locally that doesn't allow network
connections to port 3306.

The MySQL command-line client will probably work in any of these cases, as
it uses Unix domain sockets, which are really filesystem-based. You should
read the MySQL manual's installation section and use what you learn there to
figure out how your mysqld is configured. You won't be able to connect to it
using JDBC until you know for a fact that it is allowing TCP/IP connections,
what port you should connect on (3306 by default), and that you don't have
anything on your machine that prevents you from connecting to that port.



-Mark



- Original Message -

From: Lee, Andrew [EMAIL PROTECTED]

To: 'debian' [EMAIL PROTECTED]; [EMAIL PROTECTED]

Sent: Wednesday, February 06, 2002 8:23 PM

Subject: RE: Cannot connect to MySQL server with a java application



 Almost, but not exactly the same .



 DriverManager.getConnection(dburl, dbuser, dbpasswd) -- note, 3 arguments

 here



  -Original Message-

  From: debian [SMTP:[EMAIL PROTECTED]]

  Sent: Wednesday, February 06, 2002 1:59 PM

  To: [EMAIL PROTECTED]

  Subject: Cannot connect to MySQL server with a java application

 

  hello,

 

  i tried to connect my MySQL-Server with a short java application. The

  application can't connect to the server, obviously the server is running

  on

  localhost:3306. I append the SourceCode (roughly the same:

 

http://lists.mysql.com/cgi-ez/ezmlm-cgi?1:mss:80228:200107:popciohjmlbbolp

  ak

  ) and the error-message.

 

  SourceCode:

  import java.sql.*;

 

  class SQLtest2

  {

  public static void main(String[] args)

  {

  try

  {

  Class.forName(org.gjt.mm.mysql.Driver).newInstance();

  System.out.println(register the Driver: OK);

  }

  catch (Exception e){}

  try

  {

  Connection conn =

 

DriverManager.getConnection(jdbc:mysql://127.0.0.1:3306/test?user=testpa

  ss

  word=teschd);

  System.out.println(... ccnnected);

  Statement s = conn.createStatement();

  s.close();

  conn.close();

  }

  catch(SQLException e)

  {

  System.out.println(SQLException:  + e.getMessage());

  System.out.println(SQLState:  + e.getSQLState());

  System.out.println(VendorError:  + e.getErrorCode());

  }

 

  }

  }

 

  Error-Msg:

 

  register the Driver: OK

  java.io.IOException: Connection timed out

  at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:56)

  (some EXCeptions more)

  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.io.IOException)

  SQLState: 08S01

  VendorError: 0

 

  is there somebody who can help me?

 

  thnx bobby

 



-
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




Cannot connect to MySQL server with a java application

2002-02-06 Thread debian

hello,

i tried to connect my MySQL-Server with a short java application. The
application can't connect to the server, obviously the server is running on
localhost:3306. I append the SourceCode (roughly the same:
http://lists.mysql.com/cgi-ez/ezmlm-cgi?1:mss:80228:200107:popciohjmlbbolpak
) and the error-message.

SourceCode:
import java.sql.*;

class SQLtest2
{
public static void main(String[] args)
{
try
  {
   Class.forName(org.gjt.mm.mysql.Driver).newInstance();
   System.out.println(register the Driver: OK);
  }
  catch (Exception e){}
  try
  {
   Connection conn =
DriverManager.getConnection(jdbc:mysql://127.0.0.1:3306/test?user=testpass
word=teschd);
  System.out.println(... ccnnected);
  Statement s = conn.createStatement();
   s.close();
  conn.close();
  }
  catch(SQLException e)
  {
  System.out.println(SQLException:  + e.getMessage());
   System.out.println(SQLState:  + e.getSQLState());
  System.out.println(VendorError:  + e.getErrorCode());
  }

}
}

Error-Msg:

register the Driver: OK
java.io.IOException: Connection timed out
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:56)
(some EXCeptions more)
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.io.IOException)
SQLState: 08S01
VendorError: 0

is there somebody who can help me?

thnx bobby


-
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




RE: Cannot connect to MySQL server with a java application

2002-02-06 Thread Lee, Andrew

Almost, but not exactly the same .

DriverManager.getConnection(dburl, dbuser, dbpasswd) -- note, 3 arguments
here

 -Original Message-
 From: debian [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, February 06, 2002 1:59 PM
 To:   [EMAIL PROTECTED]
 Subject:  Cannot connect to MySQL server with a java application
 
 hello,
 
 i tried to connect my MySQL-Server with a short java application. The
 application can't connect to the server, obviously the server is running
 on
 localhost:3306. I append the SourceCode (roughly the same:
 http://lists.mysql.com/cgi-ez/ezmlm-cgi?1:mss:80228:200107:popciohjmlbbolp
 ak
 ) and the error-message.
 
 SourceCode:
 import java.sql.*;
 
 class SQLtest2
 {
 public static void main(String[] args)
 {
 try
   {
Class.forName(org.gjt.mm.mysql.Driver).newInstance();
System.out.println(register the Driver: OK);
   }
   catch (Exception e){}
   try
   {
Connection conn =
 DriverManager.getConnection(jdbc:mysql://127.0.0.1:3306/test?user=testpa
 ss
 word=teschd);
   System.out.println(... ccnnected);
   Statement s = conn.createStatement();
s.close();
   conn.close();
   }
   catch(SQLException e)
   {
   System.out.println(SQLException:  + e.getMessage());
System.out.println(SQLState:  + e.getSQLState());
   System.out.println(VendorError:  + e.getErrorCode());
   }
 
 }
 }
 
 Error-Msg:
 
 register the Driver: OK
 java.io.IOException: Connection timed out
 at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:56)
 (some EXCeptions more)
 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.io.IOException)
 SQLState: 08S01
 VendorError: 0
 
 is there somebody who can help me?
 
 thnx bobby
 

-
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




RE: java.sql.SQLException: Cannot connect to MySQL server onlocalhost:3306.

2001-11-18 Thread Prasad Valmeti

Hi Venu,
Thanks for ur response.
Ur first guess is correct ... mysqld server is not running.

But whenever i tried to run it, it is showing this error:

08 13:59:01  Can't start server : Bind on unix socket: Address
already in use
08 13:59:01  Do you already have another mysqld server running
on  socket:/tmp/mysql.sock ?
08 13:59:01  Aborting

I have tried to run it on different ports using -P option. But still
i am getting same   error.
regds,
 Prasad.

-Original Message-
From: Venu [mailto:[EMAIL PROTECTED]]
Sent: Saturday, November 17, 2001 9:39 PM
To: Prasad Valmeti; Nguyen Trong Phuc; [EMAIL PROTECTED]
Subject: RE: java.sql.SQLException: Cannot connect to MySQL server
onlocalhost:3306.


Hi, 

 -Original Message-
 From: Prasad Valmeti [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, November 17, 2001 4:31 AM
 To: Nguyen Trong Phuc; [EMAIL PROTECTED]
 Subject: java.sql.SQLException: Cannot connect to MySQL server on
 localhost:3306.
 
 
 Thanks for ur response.
 I am sending code also. Earlier it was connected to data base.
 I haven't used it sometime. Now i am trying but unable to connect to Data
 base.
 
 Please have look and suggest me some solution to solve this problem.
 
 import java.io.*;
 import java.sql.*;
 import java.util.*;
 
 public class TextToDatabaseTable {
private static final String DB = secmngr,
TABLE_NAME = records,
HOST = jdbc:mysql://localhost:3306/,
ACCOUNT = scott, 
PASSWORD = tiger,
DRIVER = org.gjt.mm.mysql.Driver,
FILENAME = records.txt;
 
public static void main (String[] args) {
   try {
 
  // connect to db
  Properties props = new Properties();
  props.setProperty(user, ACCOUNT);
  props.setProperty(password, PASSWORD);
 
  Class.forName(DRIVER).newInstance();
  Connection con = DriverManager.getConnection(HOST + DB, props); 
  Statement stmt = con.createStatement(); 
 
  // open text file
  BufferedReader in = new BufferedReader( 
 new FileReader(FILENAME));
 
  // read and parse a line
  String line = in.readLine();
  while(line != null) {
 
 StringTokenizer tk = new StringTokenizer(line);
 String first = tk.nextToken(),
last = tk.nextToken(),
email = tk.nextToken(),
phone = tk.nextToken();
 
 // execute SQL insert statement
 String query = INSERT INTO  + TABLE_NAME;
 query +=  VALUES( + quote(first) + , ;
 query += quote(last) + , ;
 query += quote(email) + , ;
 query += quote(phone) + );;
 stmt.executeQuery(query);
 
 // prepare to process next line
 line = in.readLine();
  }
  in.close();
   }
 
   catch( Exception e) { 
  e.printStackTrace();
   } 
}
 
// protect data with quotes
private static String quote(String include) {
   return(\ + include + \);
}
 }
 
 I am not sending errors because those are in the below mails.

The possible reasons are:

1. The server is not up and running
2. The server is up and running, but not to the default port.

Regards, venu

 
 Thanks,
 Prasad.
 -Original Message-
 From: Nguyen Trong Phuc [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, November 18, 2001 8:50 AM
 To: Prasad Valmeti; [EMAIL PROTECTED]
 Subject: Re: hai
 
 
 Hi Valmeti !
 
 it's general error, have too many reason. how about yr source code.
 maybe grant access, mm.mysql driver ...
 
 
 - Original Message -
 From: Prasad Valmeti [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Saturday, 17 November, 2001 2:49 AM
 Subject: hai
 
 
 
 
 Hai All,
 I am using Mysql, JDBC on LINUX.
 I am unable to connect Mysql from JDBC.
 
 I am getting these errors ::
 
 
 java.net.ConnectException: Connection refused
 at java.net.PlainSocketImpl.socketConnect(Native Method)
 at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:320)
 at
 java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:133)
 at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:120)
 at java.net.Socket.init(Socket.java:273)
 at java.net.Socket.init(Socket.java:100)
 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:517)
 at java.sql.DriverManager.getConnection(DriverManager.java:146)
 at TextToDatabaseTable.main(TextToDatabaseTable.java:23)
 java.sql.SQLException: Cannot

Re: java.sql.SQLException: Cannot connect to MySQL server on localhost:3306.

2001-11-18 Thread Nguyen Trong Phuc

Hi Venu !
First, u should try use :

Connection con = DriverManager.getConnection(HOST + DB, ACCOUNT,
PASSWORD);

intead of Properties. I writer java servlet, so i placed mm.driver in lib
dir of each context, what's version of yr mm.driver, i'm using 2.0.4. u can
know what's port running by nmap (included in power tools disk of RedHat)
$nmap localhost
u will know what service with what port is running
or : $ps -aux / $ps -e to know mysqld is running.

good luck
Trong Phuc

- Original Message -
From: Prasad Valmeti [EMAIL PROTECTED]
To: Nguyen Trong Phuc [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Saturday, 17 November, 2001 4:31 AM
Subject: java.sql.SQLException: Cannot connect to MySQL server on
localhost:3306.


Thanks for ur response.
I am sending code also. Earlier it was connected to data base.
I haven't used it sometime. Now i am trying but unable to connect to Data
base.

Please have look and suggest me some solution to solve this problem.

import java.io.*;
import java.sql.*;
import java.util.*;

public class TextToDatabaseTable {
   private static final String DB = secmngr,
   TABLE_NAME = records,
   HOST = jdbc:mysql://localhost:3306/,
   ACCOUNT = scott,
   PASSWORD = tiger,
   DRIVER = org.gjt.mm.mysql.Driver,
   FILENAME = records.txt;

   public static void main (String[] args) {
  try {

 // connect to db
 Properties props = new Properties();
 props.setProperty(user, ACCOUNT);
 props.setProperty(password, PASSWORD);

 Class.forName(DRIVER).newInstance();
 Connection con = DriverManager.getConnection(HOST + DB, props);
 Statement stmt = con.createStatement();

 // open text file
 BufferedReader in = new BufferedReader(
new FileReader(FILENAME));

 // read and parse a line
 String line = in.readLine();
 while(line != null) {

StringTokenizer tk = new StringTokenizer(line);
String first = tk.nextToken(),
   last = tk.nextToken(),
   email = tk.nextToken(),
   phone = tk.nextToken();

// execute SQL insert statement
String query = INSERT INTO  + TABLE_NAME;
query +=  VALUES( + quote(first) + , ;
query += quote(last) + , ;
query += quote(email) + , ;
query += quote(phone) + );;
stmt.executeQuery(query);

// prepare to process next line
line = in.readLine();
 }
 in.close();
  }

  catch( Exception e) {
 e.printStackTrace();
  }
   }

   // protect data with quotes
   private static String quote(String include) {
  return(\ + include + \);
   }
}

I am not sending errors because those are in the below mails.

Thanks,
Prasad.
-Original Message-
From: Nguyen Trong Phuc [mailto:[EMAIL PROTECTED]]
Sent: Sunday, November 18, 2001 8:50 AM
To: Prasad Valmeti; [EMAIL PROTECTED]
Subject: Re: hai


Hi Valmeti !

it's general error, have too many reason. how about yr source code.
maybe grant access, mm.mysql driver ...


- Original Message -
From: Prasad Valmeti [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, 17 November, 2001 2:49 AM
Subject: hai




Hai All,
I am using Mysql, JDBC on LINUX.
I am unable to connect Mysql from JDBC.

I am getting these errors ::


java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:320)
at
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:133)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:120)
at java.net.Socket.init(Socket.java:273)
at java.net.Socket.init(Socket.java:100)
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:517)
at java.sql.DriverManager.getConnection(DriverManager.java:146)
at TextToDatabaseTable.main(TextToDatabaseTable.java:23)
java.sql.SQLException: Cannot connect to MySQL server on localhost:3306. Is
ther
e 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:517)
at java.sql.DriverManager.getConnection(DriverManager.java:146)
at TextToDatabaseTable.main(TextToDatabaseTable.java:23)


Please help me to solve out this problem.
Thanks,
 Prasad

RE: java.sql.SQLException: Cannot connect to MySQL serveronlocalhost:3306.

2001-11-18 Thread Venu

Hi,

 -Original Message-
 From: Prasad Valmeti [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, November 18, 2001 12:42 AM
 To: [EMAIL PROTECTED]; Nguyen Trong Phuc; [EMAIL PROTECTED]
 Subject: RE: java.sql.SQLException: Cannot connect to MySQL server
 onlocalhost:3306.


 Hi Venu,
   Thanks for ur response.
   Ur first guess is correct ... mysqld server is not running.

   But whenever i tried to run it, it is showing this error:

   08 13:59:01  Can't start server : Bind on unix socket: Address
 already in use
   08 13:59:01  Do you already have another mysqld server running
 onsocket:/tmp/mysql.sock ?
   08 13:59:01  Aborting

   I have tried to run it on different ports using -P option. But still
 i am getting same error.

Please check the following link for more information on this:
http://www.mysql.com/documentation/mysql/bychapter/manual_Installing.html#Start
ing_server

Regards, venu
--
For technical support contracts, go to https://order.mysql.com
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /  Mr. Venu [EMAIL PROTECTED]
 / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Developer
/_/  /_/\_, /___/\___\_\___/ California, USA
   ___/ www.mysql.com


 -Original Message-
 From: Venu [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, November 17, 2001 9:39 PM
 To: Prasad Valmeti; Nguyen Trong Phuc; [EMAIL PROTECTED]
 Subject: RE: java.sql.SQLException: Cannot connect to MySQL server
 onlocalhost:3306.


 Hi,

  -Original Message-
  From: Prasad Valmeti [mailto:[EMAIL PROTECTED]]
  Sent: Saturday, November 17, 2001 4:31 AM
  To: Nguyen Trong Phuc; [EMAIL PROTECTED]
  Subject: java.sql.SQLException: Cannot connect to MySQL server on
  localhost:3306.
 
 
  Thanks for ur response.
  I am sending code also. Earlier it was connected to data base.
  I haven't used it sometime. Now i am trying but unable to connect to Data
  base.
 
  Please have look and suggest me some solution to solve this problem.
 
  import java.io.*;
  import java.sql.*;
  import java.util.*;
 
  public class TextToDatabaseTable {
 private static final String DB = secmngr,
 TABLE_NAME = records,
 HOST = jdbc:mysql://localhost:3306/,
 ACCOUNT = scott,
 PASSWORD = tiger,
 DRIVER = org.gjt.mm.mysql.Driver,
 FILENAME = records.txt;
 
 public static void main (String[] args) {
try {
 
   // connect to db
   Properties props = new Properties();
   props.setProperty(user, ACCOUNT);
   props.setProperty(password, PASSWORD);
 
   Class.forName(DRIVER).newInstance();
   Connection con = DriverManager.getConnection(HOST + DB, props);
   Statement stmt = con.createStatement();
 
   // open text file
   BufferedReader in = new BufferedReader(
  new FileReader(FILENAME));
 
   // read and parse a line
   String line = in.readLine();
   while(line != null) {
 
  StringTokenizer tk = new StringTokenizer(line);
  String first = tk.nextToken(),
 last = tk.nextToken(),
 email = tk.nextToken(),
 phone = tk.nextToken();
 
  // execute SQL insert statement
  String query = INSERT INTO  + TABLE_NAME;
  query +=  VALUES( + quote(first) + , ;
  query += quote(last) + , ;
  query += quote(email) + , ;
  query += quote(phone) + );;
  stmt.executeQuery(query);
 
  // prepare to process next line
  line = in.readLine();
   }
   in.close();
}
 
catch( Exception e) {
   e.printStackTrace();
}
 }
 
 // protect data with quotes
 private static String quote(String include) {
return(\ + include + \);
 }
  }
 
  I am not sending errors because those are in the below mails.

 The possible reasons are:

 1. The server is not up and running
 2. The server is up and running, but not to the default port.

 Regards, venu

 
  Thanks,
  Prasad.
  -Original Message-
  From: Nguyen Trong Phuc [mailto:[EMAIL PROTECTED]]
  Sent: Sunday, November 18, 2001 8:50 AM
  To: Prasad Valmeti; [EMAIL PROTECTED]
  Subject: Re: hai
 
 
  Hi Valmeti !
 
  it's general error, have too many reason. how about yr source code.
  maybe grant access, mm.mysql driver ...
 
 
  - Original Message -
  From: Prasad Valmeti [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Saturday, 17 November, 2001 2:49 AM
  Subject: hai
 
 
 
 
  Hai All,
  I am using Mysql, JDBC on LINUX.
  I am unable to connect Mysql from JDBC.
 
  I am getting these errors ::
 
 
  java.net.ConnectException: Connection refused

java.sql.SQLException: Cannot connect to MySQL server on localhost:3306.

2001-11-17 Thread Prasad Valmeti

Thanks for ur response.
I am sending code also. Earlier it was connected to data base.
I haven't used it sometime. Now i am trying but unable to connect to Data
base.

Please have look and suggest me some solution to solve this problem.

import java.io.*;
import java.sql.*;
import java.util.*;

public class TextToDatabaseTable {
   private static final String DB = secmngr,
   TABLE_NAME = records,
   HOST = jdbc:mysql://localhost:3306/,
   ACCOUNT = scott, 
   PASSWORD = tiger,
   DRIVER = org.gjt.mm.mysql.Driver,
   FILENAME = records.txt;

   public static void main (String[] args) {
  try {

 // connect to db
 Properties props = new Properties();
 props.setProperty(user, ACCOUNT);
 props.setProperty(password, PASSWORD);

 Class.forName(DRIVER).newInstance();
 Connection con = DriverManager.getConnection(HOST + DB, props); 
 Statement stmt = con.createStatement(); 

 // open text file
 BufferedReader in = new BufferedReader( 
new FileReader(FILENAME));

 // read and parse a line
 String line = in.readLine();
 while(line != null) {

StringTokenizer tk = new StringTokenizer(line);
String first = tk.nextToken(),
   last = tk.nextToken(),
   email = tk.nextToken(),
   phone = tk.nextToken();

// execute SQL insert statement
String query = INSERT INTO  + TABLE_NAME;
query +=  VALUES( + quote(first) + , ;
query += quote(last) + , ;
query += quote(email) + , ;
query += quote(phone) + );;
stmt.executeQuery(query);

// prepare to process next line
line = in.readLine();
 }
 in.close();
  }

  catch( Exception e) { 
 e.printStackTrace();
  } 
   }

   // protect data with quotes
   private static String quote(String include) {
  return(\ + include + \);
   }
}

I am not sending errors because those are in the below mails.

Thanks,
Prasad.
-Original Message-
From: Nguyen Trong Phuc [mailto:[EMAIL PROTECTED]]
Sent: Sunday, November 18, 2001 8:50 AM
To: Prasad Valmeti; [EMAIL PROTECTED]
Subject: Re: hai


Hi Valmeti !

it's general error, have too many reason. how about yr source code.
maybe grant access, mm.mysql driver ...


- Original Message -
From: Prasad Valmeti [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, 17 November, 2001 2:49 AM
Subject: hai




Hai All,
I am using Mysql, JDBC on LINUX.
I am unable to connect Mysql from JDBC.

I am getting these errors ::


java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:320)
at
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:133)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:120)
at java.net.Socket.init(Socket.java:273)
at java.net.Socket.init(Socket.java:100)
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:517)
at java.sql.DriverManager.getConnection(DriverManager.java:146)
at TextToDatabaseTable.main(TextToDatabaseTable.java:23)
java.sql.SQLException: Cannot connect to MySQL server on localhost:3306. Is
ther
e 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:517)
at java.sql.DriverManager.getConnection(DriverManager.java:146)
at TextToDatabaseTable.main(TextToDatabaseTable.java:23)


Please help me to solve out this problem.
Thanks,
 Prasad.

-
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



-
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




RE: java.sql.SQLException: Cannot connect to MySQL server onlocalhost:3306.

2001-11-17 Thread Venu

Hi, 

 -Original Message-
 From: Prasad Valmeti [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, November 17, 2001 4:31 AM
 To: Nguyen Trong Phuc; [EMAIL PROTECTED]
 Subject: java.sql.SQLException: Cannot connect to MySQL server on
 localhost:3306.
 
 
 Thanks for ur response.
 I am sending code also. Earlier it was connected to data base.
 I haven't used it sometime. Now i am trying but unable to connect to Data
 base.
 
 Please have look and suggest me some solution to solve this problem.
 
 import java.io.*;
 import java.sql.*;
 import java.util.*;
 
 public class TextToDatabaseTable {
private static final String DB = secmngr,
TABLE_NAME = records,
HOST = jdbc:mysql://localhost:3306/,
ACCOUNT = scott, 
PASSWORD = tiger,
DRIVER = org.gjt.mm.mysql.Driver,
FILENAME = records.txt;
 
public static void main (String[] args) {
   try {
 
  // connect to db
  Properties props = new Properties();
  props.setProperty(user, ACCOUNT);
  props.setProperty(password, PASSWORD);
 
  Class.forName(DRIVER).newInstance();
  Connection con = DriverManager.getConnection(HOST + DB, props); 
  Statement stmt = con.createStatement(); 
 
  // open text file
  BufferedReader in = new BufferedReader( 
 new FileReader(FILENAME));
 
  // read and parse a line
  String line = in.readLine();
  while(line != null) {
 
 StringTokenizer tk = new StringTokenizer(line);
 String first = tk.nextToken(),
last = tk.nextToken(),
email = tk.nextToken(),
phone = tk.nextToken();
 
 // execute SQL insert statement
 String query = INSERT INTO  + TABLE_NAME;
 query +=  VALUES( + quote(first) + , ;
 query += quote(last) + , ;
 query += quote(email) + , ;
 query += quote(phone) + );;
 stmt.executeQuery(query);
 
 // prepare to process next line
 line = in.readLine();
  }
  in.close();
   }
 
   catch( Exception e) { 
  e.printStackTrace();
   } 
}
 
// protect data with quotes
private static String quote(String include) {
   return(\ + include + \);
}
 }
 
 I am not sending errors because those are in the below mails.

The possible reasons are:

1. The server is not up and running
2. The server is up and running, but not to the default port.

Regards, venu

 
 Thanks,
 Prasad.
 -Original Message-
 From: Nguyen Trong Phuc [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, November 18, 2001 8:50 AM
 To: Prasad Valmeti; [EMAIL PROTECTED]
 Subject: Re: hai
 
 
 Hi Valmeti !
 
 it's general error, have too many reason. how about yr source code.
 maybe grant access, mm.mysql driver ...
 
 
 - Original Message -
 From: Prasad Valmeti [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Saturday, 17 November, 2001 2:49 AM
 Subject: hai
 
 
 
 
 Hai All,
 I am using Mysql, JDBC on LINUX.
 I am unable to connect Mysql from JDBC.
 
 I am getting these errors ::
 
 
 java.net.ConnectException: Connection refused
 at java.net.PlainSocketImpl.socketConnect(Native Method)
 at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:320)
 at
 java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:133)
 at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:120)
 at java.net.Socket.init(Socket.java:273)
 at java.net.Socket.init(Socket.java:100)
 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:517)
 at java.sql.DriverManager.getConnection(DriverManager.java:146)
 at TextToDatabaseTable.main(TextToDatabaseTable.java:23)
 java.sql.SQLException: Cannot connect to MySQL server on localhost:3306. Is
 ther
 e 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:517)
 at java.sql.DriverManager.getConnection(DriverManager.java:146)
 at TextToDatabaseTable.main(TextToDatabaseTable.java:23)
 
 
 Please help me to solve out this problem.
 Thanks,
  Prasad.

-- 
For technical support contracts, go to https://order.mysql.com
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /  Mr. Venu [EMAIL PROTECTED]
 / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Developer