Problemas com Banco de Dados

3 respostas
D

Pessoal, apareceu um erro, dentro do meu sistema, alguem pode me dizer, como que eu posso para tirar esse erro?

java.sql.SQLException: Syntax error or access violation message from server: “You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘FROM USUARIO’ at line 1”

3 Respostas

F

tu esta com erro em algum SQL teu…
mostra o teu codigo ai!!!

D
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JInternalFrame;
import javax.swing.JDesktopPane;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JPasswordField;
import javax.swing.JButton;
/*
 * Created on 06/07/2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */

/**
 * @author unknown
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class Login extends JInternalFrame implements ActionListener {

	private javax.swing.JPanel jContentPane = null;

	private JDesktopPane jDesktopPane = null;
	private JPanel jPanel = null;
	private JLabel jLabel = null;
	private JTextField jTextField = null;
	private JLabel jLabel1 = null;
	private JPasswordField jPasswordField = null;

	private JLabel systemIMG = null;

	private JLabel jLabel2;
	private JButton jButton = null;
	private JButton jButton1 = null;
	/**
	 * 
	 */
	public Login() {
		super();
		// TODO Auto-generated constructor stub
		initialize();
	}

	/**
	 * @param arg0
	 */
	public Login(String arg0) {
		super(arg0);
		// TODO Auto-generated constructor stub
		initialize();
	}

	/**
	 * @param arg0
	 * @param arg1
	 */
	public Login(String arg0, boolean arg1) {
		super(arg0, arg1);
		// TODO Auto-generated constructor stub
		initialize();
	}

	/**
	 * @param arg0
	 * @param arg1
	 * @param arg2
	 */
	public Login(String arg0, boolean arg1, boolean arg2) {
		super(arg0, arg1, arg2);
		// TODO Auto-generated constructor stub
		initialize();
	}

	/**
	 * @param arg0
	 * @param arg1
	 * @param arg2
	 * @param arg3
	 */
	public Login(String arg0, boolean arg1, boolean arg2, boolean arg3) {
		super(arg0, arg1, arg2, arg3);
		// TODO Auto-generated constructor stub
		initialize();
	}

	/**
	 * @param arg0
	 * @param arg1
	 * @param arg2
	 * @param arg3
	 * @param arg4
	 */
	public Login(String arg0, boolean arg1, boolean arg2, boolean arg3,
			boolean arg4) {
		super(arg0, arg1, arg2, arg3, arg4);
		// TODO Auto-generated constructor stub
		initialize();
	}

	/* (non-Javadoc)
	 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
	 */
	public void actionPerformed(ActionEvent arg0) {
		// TODO Auto-generated method stub

	}

	/**
	 * This method initializes jDesktopPane	
	 * 	
	 * @return javax.swing.JDesktopPane	
	 */    
	private JDesktopPane getJDesktopPane() {
		if (jDesktopPane == null) {
			jDesktopPane = new JDesktopPane();
			systemIMG = new javax.swing.JLabel();
			jLabel2 = new JLabel();
			jDesktopPane.setBounds(0, 0, 487, 307);
			systemIMG.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemaLogin.jpg")));
			jLabel2.setBounds(333, 116, 10, 10);
			jLabel2.setText("");
			systemIMG.setBounds(215, 17, 259, 214);
			systemIMG.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
			jDesktopPane.add(getJPanel(), null);
			jDesktopPane.add(jLabel2, null);
			jDesktopPane.add(systemIMG, null);
			jDesktopPane.setBackground(new java.awt.Color(88, 87, 104));
		}
		return jDesktopPane;
	}
	/**
	 * This method initializes jPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */    
	private JPanel getJPanel() {
		if (jPanel == null) {
			jPanel = new JPanel();
			jLabel = new JLabel();
			jLabel1 = new JLabel();
			jPanel.setLayout(null);
			jPanel.setBounds(17, 16, 190, 272);
			jPanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
			jLabel.setText("LOGIN");
			jLabel.setFont(new java.awt.Font("Bookman Old Style", java.awt.Font.BOLD, 14));
			jLabel.setLocation(17, 30);
			jLabel.setSize(70, 20);
			jLabel1.setText("SENHA");
			jLabel1.setSize(53, 20);
			jLabel1.setLocation(17, 90);
			jLabel1.setFont(new java.awt.Font("Bookman Old Style", java.awt.Font.BOLD, 14));
			jPanel.add(jLabel, null);
			jPanel.add(getJTextField(), null);
			jPanel.add(jLabel1, null);

			jPanel.add(getJPasswordField(), null);
			jPanel.add(getJButton(), null);
			jPanel.add(getJButton1(), null);
		}
		return jPanel;
	}
	/**
	 * This method initializes jTextField	
	 * 	
	 * @return javax.swing.JTextField	
	 */    
	private JTextField getJTextField() {
		if (jTextField == null) {
			jTextField = new JTextField();
			jTextField.setSize(150, 20);
			jTextField.setLocation(17, 55);
		}
		return jTextField;
	}
	/**
	 * This method initializes jPasswordField	
	 * 	
	 * @return javax.swing.JPasswordField	
	 */    
	private JPasswordField getJPasswordField() {
		if (jPasswordField == null) {
			jPasswordField = new JPasswordField();
			jPasswordField.setLocation(17, 125);
			jPasswordField.setSize(150, 20);
		}
		return jPasswordField;
	}
	/**
	 * This method initializes jButton	
	 * 	
	 * @return javax.swing.JButton	
	 */    
	private JButton getJButton() {
		if (jButton == null) {
			jButton = new JButton();
			jButton.setText("OK");
			jButton.setLocation(26, 159);
			jButton.setSize(90, 39);
			jButton.addActionListener(new java.awt.event.ActionListener() { 
				public void actionPerformed(java.awt.event.ActionEvent e) {    
					//System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
					jTextField.getText();
					jPasswordField.getPassword();
					if (jTextField.getText()=="" || jPasswordField.getText()==""){
						JOptionPane.showMessageDialog(null,"Campos em branco");
					}
					else{
					try
					{
						Conexao.conectar().createStatement().executeQuery("SELECT * FROM USUARIO" );
						//jTextField.setText("");
						//jPasswordField.setText("");
						JOptionPane.showMessageDialog(null,"Usuário localizado com sucesso");
					}
					catch (Exception error){
						System.out.println(error);
					}
					}
				}
			});

		}
		return jButton;
	}
	/**
	 * This method initializes jButton1	
	 * 	
	 * @return javax.swing.JButton	
	 */    
	private JButton getJButton1() {
		if (jButton1 == null) {
			jButton1 = new JButton();
			jButton1.setText("SAIR");
			jButton1.setSize(90, 39);
			jButton1.setLocation(26, 209);
			jButton1.addActionListener(new java.awt.event.ActionListener() { 
				public void actionPerformed(java.awt.event.ActionEvent e) {    
					System.exit(0); // TODO Auto-generated Event stub actionPerformed()
				}
			});
		}
		return jButton1;
	}
      	public static void main(String[] args) {
	}
	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setTitle("Login SCE");
		this.setSize(497, 341);
		this.setContentPane(getJContentPane());
		this.setVisible(true);
		this.setClosable(true);
		this.setMaximizable(true);
	}
	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private javax.swing.JPanel getJContentPane() {
		if(jContentPane == null) {
			jContentPane = new javax.swing.JPanel();
			jContentPane.setLayout(null);
			jContentPane.add(getJDesktopPane(), null);
		}
		return jContentPane;
	}
}  //  @jve:decl-index=0:visual-constraint="10,10"

[size=“11”]
[color=“red”]

  • Editado: Aumente as chances de alguém responder o seu tópico. Use BBCode em seus códigos para mantê-los identados e mais legíveis para outros usuários. - Matheus[/color][/size] :joia:
A

Select * from usuario ???
Cara o que vc vai fazer com esse resultado?

  • é foda!!
    Eu trabalhaova em uma empresa que os caras ate batiam em quem colocava * na query!
    Da uma olhada no objetivo desse sql, se for para setar objetos vc tará algum problemas com esse *!!!
    Olha aê!!!
Criado 15 de julho de 2005
Ultima resposta 15 de jul. de 2005
Respostas 3
Participantes 3