Problemas com MySQL no Netbeans

2 respostas
R

Fiz o download do mmmysql3.1.2 instalei com o netbeans 5.0, ele acessa o banco, mostra minhas tabelas, tudo. Mas quando eu tendo incluir dados nele simplismente me retorna este erro.

init:

deps-jar:

compile:

run:

java.lang.UnsupportedOperationException: Not yet implemented

at hfuniformes.Usuario.jButton1ActionPerformed(Usuario.java:151)

at hfuniformes.Usuario.access$100(Usuario.java:16)

at hfuniformes.Usuario$2.actionPerformed(Usuario.java:69)

at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)

at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)

at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)

at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)

at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)

at java.awt.Component.processMouseEvent(Component.java:5100)

at java.awt.Component.processEvent(Component.java:4897)

at java.awt.Container.processEvent(Container.java:1569)

at java.awt.Component.dispatchEventImpl(Component.java:3615)

at java.awt.Container.dispatchEventImpl(Container.java:1627)

at java.awt.Component.dispatchEvent(Component.java:3477)

at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)

at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)

at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)

at java.awt.Container.dispatchEventImpl(Container.java:1613)

at java.awt.Window.dispatchEventImpl(Window.java:1606)

at java.awt.Component.dispatchEvent(Component.java:3477)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:480)

at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

BUILD SUCCESSFUL (total time: 25 seconds)

2 Respostas

M

Posta ai a instrução que você está utilizando pra inserção, talvez seja algum erro nela.

R

Resolvi o problema usando o exemplo que achei no forum que foi postado pouco tempo depois de mim.

bom, usei o exemplo mas mesmo assim apresentou o seguinte problema.

init:

deps-jar:

Compiling 1 source file to D:\HFUniformes\build\classes

D:\HFUniformes\src\hfuniformes\Identificacao.java:110: illegal start of expression

private Banco(){

1 error

BUILD FAILED (total time: 0 seconds)

o código é:

/*

  • Identificacao.java
  • Created on 21 de Março de 2006, 00:15
    */

package hfuniformes;

import java.sql.<em>;

import javax.swing.</em>;

/**

*
  • @author 2º BIS
    */
    public class Identificacao extends java.awt.Frame {

    /**

    • Creates new form Identificacao
      */
      public Identificacao() {
      initComponents();
      }

    /** This method is called from within the constructor to

    • initialize the form.

    • WARNING: Do NOT modify this code. The content of this method is

    • always regenerated by the Form Editor.
      
      */
      
      // <editor-fold defaultstate=“collapsed” desc=" Generated Code ">
      
      private void initComponents() {
      
      jSeparator1 = new javax.swing.JSeparator();
      
      jLabel1 = new javax.swing.JLabel();
      
      jLabel2 = new javax.swing.JLabel();
      
      jTextField1 = new javax.swing.JTextField();
      
      jButton1 = new javax.swing.JButton();
      
      jButton2 = new javax.swing.JButton();
      
      jPasswordField1 = new javax.swing.JPasswordField();
      
      jSeparator4 = new javax.swing.JSeparator();
      
      jSeparator2 = new javax.swing.JSeparator();
      

      setLayout(null);

      setBackground(new java.awt.Color(255, 255, 255));
      
      setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
      
      setName(Identificacao);
      
      setTitle(IDENTIFICA\u00c7\u00c3O);
      
      addWindowListener(new java.awt.event.WindowAdapter() {
      
      public void windowClosing(java.awt.event.WindowEvent evt) {
      
      exitForm(evt);
      
      }
      
      });
      
      jLabel1.setText(USUARIO);
      
      add(jLabel1);
      
      jLabel1.setBounds(20, 50, 80, 15);
      
      jLabel2.setText(SENHA);
      
      add(jLabel2);
      
      jLabel2.setBounds(20, 80, 80, 15);
      

      add(jTextField1);
      jTextField1.setBounds(110, 50, 130, 20);

      jButton1.setText(VENDAS);
      
      jButton1.setName(identificacao);
      
      jButton1.addActionListener(new java.awt.event.ActionListener() {
      
      public void actionPerformed(java.awt.event.ActionEvent evt) {
      
      jButton1ActionPerformed(evt);
      
      }
      
      });
      

      add(jButton1);
      jButton1.setBounds(10, 110, 100, 23);

      jButton2.setText(ESTOQUE);
      
      jButton2.addActionListener(new java.awt.event.ActionListener() {
      
      public void actionPerformed(java.awt.event.ActionEvent evt) {
      
      jButton2ActionPerformed(evt);
      
      }
      
      });
      

      add(jButton2);
      jButton2.setBounds(140, 110, 100, 23);

      jPasswordField1.setText(jPasswordField1);
      
      jPasswordField1.setEchoChar(+);
      
      add(jPasswordField1);
      
      jPasswordField1.setBounds(110, 80, 130, 22);
      

      add(jSeparator4);
      jSeparator4.setBounds(230, 80, 0, 2);

      add(jSeparator2);
      jSeparator2.setBounds(110, 150, 0, 2);

      pack();
      }// </editor-fold>

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
    
    ControlarEstoque estoque = new ControlarEstoque();
    
    estoque.show();
    
    estoque.setSize(500,300);
    
    this.dispose();
    
    }
    
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    
    Vendas vendido = new Vendas();
    
    vendido.show();
    
    vendido.setSize(930,700);
    
    public Banco(){
    
    String url = jdbc:mysql://“localhost”:3306/“hiroko””;
    
    String username = root;
    
    String password = spectrum4vn;
    
    try
    
    {
    
    Class.forName(com.mysql.jdbc.Driver);
    
    connection = DriverManager.getConnection(url, root, spectrum4vn)
    
    }
    
    catch(ClassNotFoundExeption cnfex)
    
    {
    
    System.err.println(Falha ao abrir o JDBC);
    
    cnfex.printStackTrace();
    
    System.exit(1);
    
    }
    
    {
    
    catch(SQLException sqlex){
    
    System.err.println(Não foi possível se conectar);
    
    sqlex.printStackTrace();
    
    }
    
    }
    
}

this.dispose();

}
/** Exit the Application */
private void exitForm(java.awt.event.WindowEvent evt) {                          
    System.exit(0);
}                         

/**
 * @param args the command line arguments
 */
public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
        public void run() {
            new Identificacao().setVisible(true);
        }
    });
}


// Variables declaration - do not modify                     
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JPasswordField jPasswordField1;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JSeparator jSeparator4;
private javax.swing.JTextField jTextField1;
// End of variables declaration

}

Criado 1 de abril de 2006
Ultima resposta 2 de abr. de 2006
Respostas 2
Participantes 2