MySQL error

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
User avatar
netvirus
Advanced User
Advanced User
Posts: 408
Joined: Sun Aug 02, 2009 3:43 pm
Location: Russia
Contact:

MySQL error

Post by netvirus »

If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision 3940:
L2JDP Revision 7087:

Has found out an error in stdout.log:

Could not get order for (6378, 5, 3031402): com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'order FROM merchant_buylists WHERE `shop_id` = 3031402 AND `item_id` = 6378 AND ' at line 1
Could not store trade list (6373, 5, 3031402, 11): com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolati
onException: Duplicate entry '3031402-11' for key 1

What does it mean and how to correct?
FidoNet - iddqd
_DS_
L2j Veteran
L2j Veteran
Posts: 3437
Joined: Wed Apr 30, 2008 8:53 am
Location: Russia

Re: MySQL error

Post by _DS_ »

Someone trying to edit merchant npc ?
Commiter of the shit
public static final int PI = 3.1415926535897932384626433832795;
User avatar
netvirus
Advanced User
Advanced User
Posts: 408
Joined: Sun Aug 02, 2009 3:43 pm
Location: Russia
Contact:

Re: MySQL error

Post by netvirus »

No
FidoNet - iddqd
User avatar
janiii
L2j Veteran
L2j Veteran
Posts: 4269
Joined: Wed May 28, 2008 3:15 pm
Location: Slovakia

Re: MySQL error

Post by janiii »

netvirus wrote:No
i am sure it was an admin trying to edit the buylist of an npc.

fix (actuall fix is on line 740):
http://www.pastebin.cz/32353

Code: Select all

Index: AdminEditNpc.java===================================================================--- AdminEditNpc.java	(revision 7093)+++ AdminEditNpc.java	(working copy)@@ -623,7 +623,7 @@ 			if (Config.CUSTOM_MERCHANT_TABLES) 				table = "custom_merchant_buylists"; -			PreparedStatement stmt = con.prepareStatement("INSERT INTO " + table + "(`item_id`,`price`,`shop_id`,`order`) VALUES (?,?,?,?)");+			PreparedStatement stmt = con.prepareStatement("INSERT INTO `" + table + "`(`item_id`,`price`,`shop_id`,`order`) VALUES (?,?,?,?)"); 			stmt.setInt(1, itemID); 			stmt.setLong(2, price); 			stmt.setInt(3, tradeListID);@@ -659,7 +659,7 @@ 			int updated = 0; 			if (Config.CUSTOM_MERCHANT_TABLES) 			{-				PreparedStatement stmt = con.prepareStatement("UPDATE custom_merchant_buylists SET `price` = ? WHERE `shop_id` = ? AND `order` = ?");+				PreparedStatement stmt = con.prepareStatement("UPDATE `custom_merchant_buylists` SET `price` = ? WHERE `shop_id` = ? AND `order` = ?"); 				stmt.setLong(1, price); 				stmt.setInt(2, tradeListID); 				stmt.setInt(3, order);@@ -668,7 +668,7 @@ 			} 			if (updated == 0) 			{-				PreparedStatement stmt = con.prepareStatement("UPDATE merchant_buylists SET `price` = ? WHERE `shop_id` = ? AND `order` = ?");+				PreparedStatement stmt = con.prepareStatement("UPDATE `merchant_buylists` SET `price` = ? WHERE `shop_id` = ? AND `order` = ?"); 				stmt.setLong(1, price); 				stmt.setInt(2, tradeListID); 				stmt.setInt(3, order);@@ -702,7 +702,7 @@ 			int updated = 0; 			if (Config.CUSTOM_MERCHANT_TABLES) 			{-				PreparedStatement stmt = con.prepareStatement("DELETE FROM custom_merchant_buylists WHERE `shop_id` = ? AND `order` = ?");+				PreparedStatement stmt = con.prepareStatement("DELETE FROM `custom_merchant_buylists` WHERE `shop_id` = ? AND `order` = ?"); 				stmt.setInt(1, tradeListID); 				stmt.setInt(2, order); 				updated = stmt.executeUpdate();@@ -710,7 +710,7 @@ 			} 			if (updated == 0) 			{-				PreparedStatement stmt = con.prepareStatement("DELETE FROM merchant_buylists WHERE `shop_id` = ? AND `order` = ?");+				PreparedStatement stmt = con.prepareStatement("DELETE FROM `merchant_buylists` WHERE `shop_id` = ? AND `order` = ?"); 				stmt.setInt(1, tradeListID); 				stmt.setInt(2, order); 				updated = stmt.executeUpdate();@@ -740,7 +740,7 @@ 		try 		{ 			con = L2DatabaseFactory.getInstance().getConnection();-			PreparedStatement stmt = con.prepareStatement("SELECT order FROM merchant_buylists WHERE `shop_id` = ? AND `item_id` = ? AND `price` = ?");+			PreparedStatement stmt = con.prepareStatement("SELECT `order` FROM `merchant_buylists` WHERE `shop_id` = ? AND `item_id` = ? AND `price` = ?"); 			stmt.setInt(1, tradeListID); 			stmt.setInt(2, itemID); 			stmt.setLong(3, price);@@ -1179,7 +1179,7 @@ 			int updated = 0; 			if (Config.CUSTOM_DROPLIST_TABLE) 			{-				PreparedStatement statement = con.prepareStatement("UPDATE custom_droplist SET min=?, max=?, chance=? WHERE mobId=? AND itemId=? AND category=?");+				PreparedStatement statement = con.prepareStatement("UPDATE `custom_droplist` SET `min`=?, `max`=?, `chance`=? WHERE `mobId`=? AND `itemId`=? AND `category`=?"); 				statement.setInt(1, min); 				statement.setInt(2, max); 				statement.setInt(3, chance);@@ -1192,7 +1192,7 @@ 			} 			if (updated == 0) 			{-				PreparedStatement statement = con.prepareStatement("UPDATE droplist SET min=?, max=?, chance=? WHERE mobId=? AND itemId=? AND category=?");+				PreparedStatement statement = con.prepareStatement("UPDATE `droplist` SET `min`=?, `max`=?, `chance`=? WHERE `mobId`=? AND `itemId`=? AND `category`=?"); 				statement.setInt(1, min); 				statement.setInt(2, max); 				statement.setInt(3, chance);@@ -1238,7 +1238,7 @@ 			if (Config.CUSTOM_DROPLIST_TABLE) 				table = "custom_droplist"; -			PreparedStatement statement = con.prepareStatement("INSERT INTO " + table + "(mobId, itemId, min, max, category, chance) values(?,?,?,?,?,?)");+			PreparedStatement statement = con.prepareStatement("INSERT INTO `" + table + "`(`mobId`, `itemId`, `min`, `max`, `category`, `chance`) VALUES(?,?,?,?,?,?)"); 			statement.setInt(1, npcId); 			statement.setInt(2, itemId); 			statement.setInt(3, min);@@ -1307,7 +1307,7 @@ 			int updated = 0; 			if (Config.CUSTOM_DROPLIST_TABLE) 			{-				PreparedStatement statement = con.prepareStatement("DELETE FROM custom_droplist WHERE mobId=? AND itemId=? AND category=?");+				PreparedStatement statement = con.prepareStatement("DELETE FROM `custom_droplist` WHERE `mobId`=? AND `itemId`=? AND `category`=?"); 				statement.setInt(1, npcId); 				statement.setInt(2, itemId); 				statement.setInt(3, category);@@ -1316,7 +1316,7 @@ 			} 			if (updated == 0) 			{-				PreparedStatement statement = con.prepareStatement("DELETE FROM droplist WHERE mobId=? AND itemId=? AND category=?");+				PreparedStatement statement = con.prepareStatement("DELETE FROM `droplist` WHERE `mobId`=? AND `itemId`=? AND `category`=?"); 				statement.setInt(1, npcId); 				statement.setInt(2, itemId); 				statement.setInt(3, category);@@ -1363,7 +1363,7 @@ 			con = L2DatabaseFactory.getInstance().getConnection(); 			L2DropData dropData = null; -			PreparedStatement statement = con.prepareStatement("SELECT mobId, itemId, min, max, category, chance FROM droplist WHERE mobId=?");+			PreparedStatement statement = con.prepareStatement("SELECT `mobId`, `itemId`, `min`, `max`, `category`, `chance` FROM `droplist` WHERE `mobId`=?"); 			statement.setInt(1, npcId); 			ResultSet dropDataList = statement.executeQuery(); @@ -1384,7 +1384,7 @@  			if (Config.CUSTOM_DROPLIST_TABLE) 			{-				PreparedStatement statement2 = con.prepareStatement("SELECT mobId, itemId, min, max, category, chance FROM custom_droplist WHERE mobId=?");+				PreparedStatement statement2 = con.prepareStatement("SELECT `mobId`, `itemId`, `min`, `max`, `category`, `chance` FROM `custom_droplist` WHERE `mobId`=?"); 				statement2.setInt(1, npcId); 				ResultSet dropDataList2 = statement2.executeQuery(); @@ -1594,7 +1594,7 @@  			con = L2DatabaseFactory.getInstance().getConnection(); -			PreparedStatement statement = con.prepareStatement("UPDATE npcskills SET level=? WHERE npcid=? AND skillid=?");+			PreparedStatement statement = con.prepareStatement("UPDATE `npcskills` SET `level`=? WHERE `npcid`=? AND `skillid`=?"); 			statement.setInt(1, level); 			statement.setInt(2, npcId); 			statement.setInt(3, skillId);@@ -1659,7 +1659,7 @@  			con = L2DatabaseFactory.getInstance().getConnection(); -			PreparedStatement statement = con.prepareStatement("INSERT INTO npcskills(npcid, skillid, level) values(?,?,?)");+			PreparedStatement statement = con.prepareStatement("INSERT INTO `npcskills`(`npcid`, `skillid`, `level`) VALUES(?,?,?)"); 			statement.setInt(1, npcId); 			statement.setInt(2, skillId); 			statement.setInt(3, level);@@ -1697,7 +1697,7 @@  			if (npcId > 0) 			{-				PreparedStatement statement2 = con.prepareStatement("DELETE FROM npcskills WHERE npcid=? AND skillid=?");+				PreparedStatement statement2 = con.prepareStatement("DELETE FROM `npcskills` WHERE `npcid`=? AND `skillid`=?"); 				statement2.setInt(1, npcId); 				statement2.setInt(2, skillId); 				statement2.execute();@@ -1739,7 +1739,7 @@ 				npcData.getSkills().clear();  			// without race-			PreparedStatement statement = con.prepareStatement("SELECT skillid, level FROM npcskills WHERE npcid=? AND skillid <> 4416");+			PreparedStatement statement = con.prepareStatement("SELECT `skillid`, `level` FROM `npcskills` WHERE `npcid`=? AND `skillid` <> 4416"); 			statement.setInt(1, npcId); 			ResultSet skillDataList = statement.executeQuery(); 
DO NOT EVEN TRY TO MESS WITH ME!
forum flOOder dancing dEVILoper
I don't give private support - PM will be ignored!
User avatar
netvirus
Advanced User
Advanced User
Posts: 408
Joined: Sun Aug 02, 2009 3:43 pm
Location: Russia
Contact:

Re: MySQL error

Post by netvirus »

Add please on SVN.
Thx. :)
FidoNet - iddqd
User avatar
janiii
L2j Veteran
L2j Veteran
Posts: 4269
Joined: Wed May 28, 2008 3:15 pm
Location: Slovakia

Re: MySQL error

Post by janiii »

netvirus wrote:Add please on SVN.
Thx. :)
http://www.l2jdp.com/trac/changeset/7102 thx Melerix
DO NOT EVEN TRY TO MESS WITH ME!
forum flOOder dancing dEVILoper
I don't give private support - PM will be ignored!
Post Reply