Publicada por delaylahma em 12/05/2007 - 03:37h:
* delaylahma usa Slackware

Galera, alguem pode me dar uma mãozinha ...
Eu estou tentando fazer a ligação do meu software em java com o mysql , segui uns tutoriais e ja deixei tudo certinho.. mas quando ele tenta conectar com o banco com

private final String driver = "com.mysql.jdbc.Driver";
private final String url = "jdbc:mysql://localhost/caixinha";
connection = DriverManager.getConnection(url,userName,password);

ele me retorna:


com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.net.ConnectException
MESSAGE: Connection refused

STACKTRACE:

java.net.ConnectException: Connection refused
   at java.net.PlainSocketImpl.socketConnect(Native Method)
   at java.net.PlainSocketImpl.doConnect(Unknown Source)
   at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
   at java.net.PlainSocketImpl.connect(Unknown Source)
   at java.net.SocksSocketImpl.connect(Unknown Source)
   at java.net.Socket.connect(Unknown Source)
   at java.net.Socket.connect(Unknown Source)
   at java.net.Socket.<init>(Unknown Source)
   at java.net.Socket.<init>(Unknown Source)
   at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:173)
   at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:267)
   at com.mysql.jdbc.Connection.createNewIO(Connection.java:2739)
   at com.mysql.jdbc.Connection.<init>(Connection.java:1553)
   at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
   at java.sql.DriverManager.getConnection(Unknown Source)
   at java.sql.DriverManager.getConnection(Unknown Source)
   at br.lahma.caixinha.util.TabelaPainel.<init>(TabelaPainel.java:53)
   at br.lahma.caixinha.moradores.gui.JanelaMoradores.initComponents(JanelaMoradores.java:56)
   at br.lahma.caixinha.moradores.gui.JanelaMoradores.<init>(JanelaMoradores.java:35)
   at br.lahma.caixinha.principal.mediator.MediatorPrincipal.moradores(MediatorPrincipal.java:34)
   at br.lahma.caixinha.components.BotaoMoradores.execute(BotaoMoradores.java:18)
   at br.lahma.caixinha.util.Eventos.actionPerformed(Eventos.java:21)
   at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
   at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
   at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
   at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
   at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
   at java.awt.Component.processMouseEvent(Unknown Source)
   at javax.swing.JComponent.processMouseEvent(Unknown Source)
   at java.awt.Component.processEvent(Unknown Source)
   at java.awt.Container.processEvent(Unknown Source)
   at java.awt.Component.dispatchEventImpl(Unknown Source)
   at java.awt.Container.dispatchEventImpl(Unknown Source)
   at java.awt.Component.dispatchEvent(Unknown Source)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
   at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
   at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
   at java.awt.Container.dispatchEventImpl(Unknown Source)
   at java.awt.Window.dispatchEventImpl(Unknown Source)
   at java.awt.Component.dispatchEvent(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)


** END NESTED EXCEPTION **



Last packet sent to the server was 59 ms ago.
   at com.mysql.jdbc.Connection.createNewIO(Connection.java:2814)
   at com.mysql.jdbc.Connection.<init>(Connection.java:1553)
   at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
   at java.sql.DriverManager.getConnection(Unknown Source)
   at java.sql.DriverManager.getConnection(Unknown Source)
   at br.lahma.caixinha.util.TabelaPainel.<init>(TabelaPainel.java:53)
   at br.lahma.caixinha.moradores.gui.JanelaMoradores.initComponents(JanelaMoradores.java:56)
   at br.lahma.caixinha.moradores.gui.JanelaMoradores.<init>(JanelaMoradores.java:35)
   at br.lahma.caixinha.principal.mediator.MediatorPrincipal.moradores(MediatorPrincipal.java:34)
   at br.lahma.caixinha.components.BotaoMoradores.execute(BotaoMoradores.java:18)
   at br.lahma.caixinha.util.Eventos.actionPerformed(Eventos.java:21)
   at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
   at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
   at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
   at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
   at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
   at java.awt.Component.processMouseEvent(Unknown Source)
   at javax.swing.JComponent.processMouseEvent(Unknown Source)
   at java.awt.Component.processEvent(Unknown Source)
   at java.awt.Container.processEvent(Unknown Source)
   at java.awt.Component.dispatchEventImpl(Unknown Source)
   at java.awt.Container.dispatchEventImpl(Unknown Source)
   at java.awt.Component.dispatchEvent(Unknown Source)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
   at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
   at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
   at java.awt.Container.dispatchEventImpl(Unknown Source)
   at java.awt.Window.dispatchEventImpl(Unknown Source)
   at java.awt.Component.dispatchEvent(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)




Eu acho que ele tá sem permissão pra acessar o banco .. só que eu não sei como fazer isso .. alguem já passou por isso ou pode por favor me ajudar ?
abraços e obrigado...

  
Nenhuma resposta encontrada.
  


ATENÇÃO: Antes de contribuir com uma resposta, leia o artigo Qualidade de respostas e certifique-se de que esteja realmente contribuindo com a comunidade. Muitas vezes o ímpeto de contribuir nos leva a atrapalhar ao invés de ajudar.

Contribuir com resposta



CAPTCHA
[ Recarregar imagem ]

Digite o código acima:

  
* Nota: só é possível enviar respostas usuário que possui conta e esteja logado com ela, caso contrário sua mensagem será perdida.



Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts