mysql problem

Discussion in 'Bukkit Help' started by furt, Jan 27, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    furt

    im working on a sethome function that uses mysql but im having a weird problem

    heres the function:


    Code:
    public void setHome(Player player, Location home) {
            // TODO setHome save method
            Connection conn = null;
            Statement stmt = null;
            int count = 0;
    
            String pname = player.getName();
            x = home.getX();
            y = home.getY();
            z = home.getZ();
            yaw = home.getYaw();
            pitch = home.getPitch();
            try {
                conn = ceConnector.getConnection();
                stmt = conn.createStatement();
                count += stmt.executeUpdate(
                        "INSERT INTO home"
                        + " (pname, x, y, z, pitch, yaw)"
                        + " VALUES ("+pname+", "+x+", "+y+", "+z+", "+pitch+", "+yaw+")");
                stmt.close();
                player.sendMessage(CraftEssence.premessage + "Home set.");
            } catch (SQLException ex) {
                CraftEssence.log.log(Level.SEVERE,
                        "[CraftEssence]: Find SQL Exception", ex);
                player.sendMessage(CraftEssence.premessage + "Home did not save.");
            }
        }
    
    and heres the db table:

    Code:
    CREATE TABLE `home` (
      `pname` varchar(30) NOT NULL,
      `x` varchar(30) NOT NULL DEFAULT '0',
      `y` varchar(30) NOT NULL DEFAULT '0',
      `z` varchar(30) NOT NULL DEFAULT '0',
      `pitch` varchar(30) NOT NULL DEFAULT '0',
      `yaw` varchar(30) NOT NULL DEFAULT '0',
      KEY `NewIndex1` (`pname`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
    
    The error i get is this:
    com.mysql.jdbc.exceptions.jdbc4.MySWLSyntaxErrorException: Unknown column 'furt' in 'field list'


    im sure its something simple im doing wrong just started learning to use mysql with java so any help would be appreciated.
     
  2. Offline

    TnT

    Need help with what?

    There is no basic MySQL support for bukkit. If you need help with a plugin, post on the plugin thread.
     
  3. Offline

    furt

    bump, I still need help with this.
    --- merged: Jan 28, 2011 8:41 PM ---
    Nvm solved my own issue it was.

    Code:
    "INSERT INTO home"
                        + " (`pname`, `x`, `y`, `z`, `pitch`, `yaw`)"
                        + " VALUES ('"+pname+"', '"+x+"', '"+y+"', '"+z+"', '"+pitch+"', '"+yaw+"')");
    
    it was staring me in the face the whole time lol
     
Thread Status:
Not open for further replies.

Share This Page