Check params...
This is a discussion on v83 supremems source added ring effect bat error within the Help forums, part of the Java Based (Odin) category; PHP Code: java . sql . SQLException : Parameter index out of range ( 12 > number of parameters , which is 11 ). at com . mysql ...
PHP Code:java.sql.SQLException: Parameter index out of range (12 > number of parameters,
which is 11).
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
at com.mysql.jdbc.PreparedStatement.checkBounds(PreparedStatement.java:3
288)
at com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:3
272)
at com.mysql.jdbc.PreparedStatement.setString(PreparedStatement.java:410
8)
at client.ItemFactory.saveItems(ItemFactory.java:118)
at client.MapleCharacter.saveToDB(MapleCharacter.java:4723)
at client.MapleCharacter$14.run(MapleCharacter.java:5588)
at server.TimerManager$LoggingSaveRunnable.run(TimerManager.java:140)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
access$101(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
runPeriodic(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Last edited by xAlan; 21-01-12 at 11:48 AM.
Nothing're Special :(
Can i knw where to check it >?
Nothing're Special :(
Maybe can be a error on SQL... but im not sure..
I know but idk where . lol
Nothing're Special :(
The error speaks for itself
at client.ItemFactory.saveItems(ItemFactory.java:118)
at client.MapleCharacter.saveToDB(MapleCharacter.java:4723)
at client.MapleCharacter$14.run(MapleCharacter.java:5588)
at client.FileName.function(filename.java:line)
"You got a dream, you gotta protect it. People can't do something themselves, they wanna tell you that you can't do it. You want something? Go get it. Period. ~Will Smith"
Anyone help ? how to fix this probelm ?
MapleCharacter line4723 :PHP Code:java.sql.SQLException: Parameter index out of range (12 > number of parameters,
which is 11).
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
at com.mysql.jdbc.PreparedStatement.checkBounds(PreparedStatement.java:3
288)
at com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:3
272)
at com.mysql.jdbc.PreparedStatement.setString(PreparedStatement.java:410
8)
at client.ItemFactory.saveItems(ItemFactory.java:118)
at client.MapleCharacter.saveToDB(MapleCharacter.java:4723)
at client.MapleCharacter$14.run(MapleCharacter.java:5588)
at server.TimerManager$LoggingSaveRunnable.run(TimerManager.java:140)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
access$101(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
runPeriodic(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
MapleCharacter line 5588 :PHP Code:public void saveToDB(boolean update) {
if ((update) && this.trade != null) {
return;
}
Connection con = DatabaseConnection.getConnection();
try {
con.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
con.setAutoCommit(false);
PreparedStatement ps;
if (update) {
ps = con.prepareStatement("UPDATE characters SET level = ?, fame = ?, str = ?, dex = ?, luk = ?, `int` = ?, exp = ?, hp = ?, mp = ?, maxhp = ?, maxmp = ?, sp = ?, ap = ?, gm = ?, skincolor = ?, gender = ?, job = ?, hair = ?, face = ?, map = ?, meso = ?, hpMpUsed = ?, spawnpoint = ?, party = ?, buddyCapacity = ?, messengerid = ?, messengerposition = ?, reborns = ?, damagerecord = ?, fishingexp = ?, fishinglevel = ?, cookingexp = ?, cookinglevel = ?, pvpkills = ?, pvpdeaths = ?, mountlevel = ?, mountexp = ?, mounttiredness= ?, equipslots = ?, useslots = ?, setupslots = ?, etcslots = ?, monsterbookcover = ?, watchedcygnusintro = ?, vanquisherStage = ?, dojoPoints = ?, lastDojoStage = ?, finishedDojoTutorial = ?, vanquisherKills = ?, matchcardwins = ?, matchcardlosses = ?, matchcardties = ?, omokwins = ?, omoklosses = ?, omokties = ?, occupation = ?, givenRiceCakes = ?, partyquestitems = ?, receivedMOTB = ? WHERE id = ?");
} else {
ps = con.prepareStatement("INSERT INTO characters (level, fame, str, dex, luk, `int`, exp, hp, mp, maxhp, maxmp, sp, ap, gm, skincolor, gender, job, hair, face, map, meso, hpMpUsed, spawnpoint, party, buddyCapacity, messengerid, messengerposition, reborns, damagerecord, fishingexp, fishinglevel, cookingexp, cookinglevel, pvpkills, pvpdeaths, mountlevel, mounttiredness, mountexp, equipslots, useslots, setupslots, etcslots, monsterbookcover, watchedcygnusintro, vanquisherStage, dojopoints, lastDojoStage, finishedDojoTutorial, vanquisherKills, matchcardwins, matchcardlosses, matchcardties, omokwins, omoklosses, omokties, occupation, givenRiceCakes, partyquestitems, accountid, name, world) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
}
if (gmLevel < 1 && level > 199) {
ps.setInt(1, isCygnus() ? 200 : 200);
} else {
ps.setInt(1, level);
}
ps.setInt(2, fame);
ps.setInt(3, str);
ps.setInt(4, dex);
ps.setInt(5, luk);
ps.setInt(6, int_);
ps.setInt(7, exp.get());
ps.setInt(8, hp);
ps.setInt(9, mp);
ps.setInt(10, maxhp);
ps.setInt(11, maxmp);
ps.setInt(12, remainingSp);
ps.setInt(13, remainingAp);
ps.setInt(14, gmLevel);
ps.setInt(15, skinColor.getId());
ps.setInt(16, gender);
ps.setInt(17, job.getId());
ps.setInt(18, hair);
ps.setInt(19, face);
if ((map == null) && (mapid == -1)) { //ie no data for map (shouldn't happen)
ps.setInt(20, 0);
} else if (map == null)//ie mapid set at createchar
{
ps.setInt(20, mapid);
} else if (map.getForcedReturnId() != 999999999) {
ps.setInt(20, map.getForcedReturnId());
} else {
ps.setInt(20, map.getId());
}
ps.setInt(21, meso.get());
ps.setInt(22, hpMpApUsed);
if (map == null || map.getId() == 610020000 || map.getId() == 610020001) {
ps.setInt(23, 0);
} else {
MaplePortal closest = map.findClosestSpawnpoint(getPosition());
if (closest != null) {
ps.setInt(23, closest.getId());
} else {
ps.setInt(23, 0);
}
}
ps.setInt(24, party != null ? party.getId() : -1);
ps.setInt(25, buddylist.getCapacity());
if (messenger != null) {
ps.setInt(26, messenger.getId());
ps.setInt(27, messengerposition);
ps.setInt(28, reborns);
} else {
ps.setInt(26, 0);
ps.setInt(27, 4);
ps.setInt(28, reborns);
ps.setInt(29, damagerecord);
ps.setInt(30, FishingExp);
ps.setInt(31, FishingLevel);
ps.setInt(32, CookingExp);
ps.setInt(33, CookingLevel);
ps.setInt(34, pvpkills);
ps.setInt(35, pvpdeaths);
}
if (maplemount != null) {
ps.setInt(36, maplemount.getLevel());
ps.setInt(37, maplemount.getExp());
ps.setInt(38, maplemount.getTiredness());
} else {
ps.setInt(36, 1);
ps.setInt(37, 0);
ps.setInt(38, 0);
}
for (int i = 39; i < 43; i++) {
ps.setInt(i, getInventory(MapleInventoryType.getByType((byte) (i - 37))).getSlotLimit());
}
if (update) {
monsterbook.saveCards(getId());
try {
getFamily().save();
} catch (NullPointerException npe) {
}
}
ps.setInt(43, bookCover);
ps.setInt(44, watchedCygnusIntro ? 1 : 0);
ps.setInt(45, vanquisherStage);
ps.setInt(46, dojoPoints);
ps.setInt(47, dojoStage);
ps.setInt(48, finishedDojoTutorial ? 1 : 0);
ps.setInt(49, vanquisherKills);
ps.setInt(50, matchcardwins);
ps.setInt(51, matchcardlosses);
ps.setInt(52, matchcardties);
ps.setInt(53, omokwins);
ps.setInt(54, omoklosses);
ps.setInt(55, omokties);
ps.setInt(56, occupation.getId());
ps.setInt(57, givenRiceCakes);
ps.setString(58, partyquestitems);
if (update) {
ps.setInt(59, receivedMOTB ? 1 : 0);
ps.setInt(60, id);
} else {
ps.setInt(59, accountid);
ps.setString(60, name);
ps.setInt(61, world);
}
int updateRows = ps.executeUpdate();
if (!update) {
ResultSet rs = ps.getGeneratedKeys();
if (rs.next()) {
this.id = rs.getInt(1);
} else {
throw new RuntimeException("Inserting char failed.");
}
rs.close();
} else if (updateRows < 1) {
throw new RuntimeException("Character not in database (" + id + ")");
}
for (int i = 0; i < 3; i++) {
if (pets[i] != null) {
pets[i].saveToDb();
}
}
ps.close();
deleteWhereCharacterId(con, "DELETE FROM keymap WHERE characterid = ?");
/* ps = con.prepaffreStatement("INSERT INTO keymap (characterid, `key`, `type`, `action`) VALUES (?, ?, ?, ?)");
ps.setInt(1, id);
for (Entry<Integer, MapleKeyBinding> keybinding : keymap.entrySet()) {
ps.setInt(2, keybinding.getKey().intValue());
ps.setInt(3, keybinding.getValue().getType());
ps.setInt(4, keybinding.getValue().getAction());
ps.addBatch();
}
ps.executeBatch();*/
if (!keymap.isEmpty()) {
ps = con.prepareStatement(prepareKeymapQuery());
ps.executeUpdate();
ps.close();
}
deleteWhereCharacterId(con, "DELETE FROM skillmacros WHERE characterid = ?");
ps = con.prepareStatement("INSERT INTO skillmacros (characterid, skill1, skill2, skill3, name, shout, position) VALUES (?, ?, ?, ?, ?, ?, ?)");
ps.setInt(1, getId());
for (int i = 0; i < 5; i++) {
SkillMacro macro = skillMacros[i];
if (macro != null) {
ps.setInt(2, macro.getSkill1());
ps.setInt(3, macro.getSkill2());
ps.setInt(4, macro.getSkill3());
ps.setString(5, macro.getName());
ps.setInt(6, macro.getShout());
ps.setInt(7, i);
ps.addBatch();
}
}
ps.executeBatch();
ps.close();
deleteWhereCharacterId(con, "DELETE FROM telerockmaps WHERE characterId = ?");
ps = con.prepareStatement("INSERT into telerockmaps (characterId, mapId, type) VALUES (?, ?, ?)");
ps.setInt(1, id);
for (int mapId : rockMaps) {
ps.setInt(2, mapId);
ps.setInt(3, 0);
ps.addBatch();
}
for (int mapId : vipRockMaps) {
ps.setInt(2, mapId);
ps.setInt(3, 1);
ps.addBatch();
}
ps.executeBatch();
ps.close();
List<Pair<IItem, MapleInventoryType>> itemsWithType = new ArrayList<Pair<IItem, MapleInventoryType>>();
for (MapleInventory iv : inventory) {
for (IItem item : iv.list()) {
itemsWithType.add(new Pair<IItem, MapleInventoryType>(item, iv.getType()));
}
}
ItemFactory.INVENTORY.saveItems(itemsWithType, id);
deleteWhereCharacterId(con, "DELETE FROM skills WHERE characterid = ?");
// ps = con.prepareStatement("INSERT INTO skills (characterid, skillid, skilllevel, masterlevel) VALUES (?, ?, ?, ?)");
/* ps.setInt(1, id);
for (Entry<ISkill, SkillEntry> skill : skills.entrySet()) {
ps.setInt(2, skill.getKey().getId());
ps.setInt(3, skill.getValue().skillevel);
ps.setInt(4, skill.getValue().masterlevel);
ps.addBatch();
}
ps.executeBatch();*/
if (!skills.isEmpty()) {
ps = con.prepareStatement(prepareSkillQuery());
ps.executeUpdate();
ps.close();
}
deleteWhereCharacterId(con, "DELETE FROM savedlocations WHERE characterid = ?");
ps = con.prepareStatement("INSERT INTO savedlocations (characterid, `locationtype`, `map`, `portal`) VALUES (?, ?, ?, ?)");
ps.setInt(1, id);
for (SavedLocationType savedLocationType : SavedLocationType.values()) {
if (savedLocations[savedLocationType.ordinal()] != null) {
ps.setString(2, savedLocationType.name());
ps.setInt(3, savedLocations[savedLocationType.ordinal()].getMapId());
ps.setInt(4, savedLocations[savedLocationType.ordinal()].getPortal());
ps.addBatch();
}
}
ps.executeBatch();
ps.close();
deleteWhereCharacterId(con, "DELETE FROM buddies WHERE characterid = ? AND pending = 0");
ps = con.prepareStatement("INSERT INTO buddies (characterid, `buddyid`, `pending`, `group`) VALUES (?, ?, 0, ?)");
ps.setInt(1, id);
for (BuddylistEntry entry : buddylist.getBuddies()) {
if (entry.isVisible()) {
ps.setInt(2, entry.getCharacterId());
ps.setString(3, entry.getGroup());
ps.addBatch();
}
}
ps.executeBatch();
ps.close();
deleteWhereCharacterId(con, "DELETE FROM queststatus WHERE characterid = ?");
ps = con.prepareStatement("INSERT INTO queststatus (`queststatusid`, `characterid`, `quest`, `status`, `time`, `forfeited`) VALUES (DEFAULT, ?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS);
PreparedStatement pse = con.prepareStatement("INSERT INTO queststatusmobs VALUES (DEFAULT, ?, ?, ?)");
ps.setInt(1, id);
for (MapleQuestStatus q : quests.values()) {
ps.setInt(2, q.getQuest().getId());
ps.setInt(3, q.getStatus().getId());
ps.setInt(4, (int) (q.getCompletionTime() / 1000));
ps.setInt(5, q.getForfeited());
ps.executeUpdate();
ResultSet rs = ps.getGeneratedKeys();
rs.next();
for (int mob : q.getMobKills().keySet()) {
pse.setInt(1, rs.getInt(1));
pse.setInt(2, mob);
pse.setInt(3, q.getMobKills(mob));
pse.addBatch();
}
pse.executeBatch();
rs.close();
}
pse.close();
ps.close();
ps = con.prepareStatement("UPDATE accounts SET `paypalNX` = ?, `mPoints` = ?, `cardNX` = ?, gm = ?, points = ?, `votepoints` = ?, `donationpoints` = ? WHERE id = ?");
ps.setInt(1, paypalnx);
ps.setInt(2, maplepoints);
ps.setInt(3, cardnx);
ps.setInt(4, gmLevel);
ps.setInt(5, points);
ps.setInt(6, votepoints);
ps.setInt(7, donationpoints);
ps.setInt(8, client.getAccID());
ps.executeUpdate();
ps.close();
if (storage != null) {
storage.saveToDB();
}
ps = con.prepareStatement("DELETE FROM wishlist WHERE `charid` = ?");
ps.setInt(1, id);
ps.executeUpdate();
ps.close();
ps = con.prepareStatement("INSERT INTO wishlist(`sn`, `charid`) VALUES(?, ?)");
for (int sn : wishList) {
ps.setInt(1, sn);
ps.setInt(2, id);
ps.addBatch();
}
ps.executeBatch();
ps.close();
if (gmLevel > 0) {
ps = con.prepareStatement("INSERT INTO gmlog (`cid`, `command`) VALUES (?, ?)");
ps.setInt(1, id);
for (String com : commands) {
ps.setString(2, com);
ps.addBatch();
}
ps.executeBatch();
}
ps.close();
con.commit();
ps = null;
} catch (Exception e) {
e.printStackTrace();
try {
con.rollback();
} catch (SQLException se) {
}
} finally {
try {
con.setAutoCommit(true);
con.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
} catch (Exception e) {
}
}
}
ItemFactory line 118:PHP Code:@Override
public void run() {
client.getPlayer().saveToDB(true); <<< line 5588
}
}, 300000); // 5 mins
}
TimerManager line140 :PHP Code:for (Pair<IItem, MapleInventoryType> pair : items) {
IItem item = pair.getLeft();
MapleInventoryType mit = pair.getRight();
ps.setInt(1, value);
ps.setString(2, account ? null : String.valueOf(id));
ps.setString(3, account ? String.valueOf(id) : null);
ps.setInt(4, item.getItemId());
ps.setInt(5, mit.getType());
ps.setInt(6, item.getPosition());
ps.setInt(7, item.getQuantity());
ps.setString(8, item.getOwner());
ps.setInt(9, item.getFlag());
ps.setInt(10, item.getPetId()); <<<< line 118
ps.setLong(11, item.getExpiration());
ps.setString(12, item.getGiftFrom());
ps.executeUpdate();
PHP Code:@Override
public void run() {
try {
r.run(); <<< line 140
} catch (Throwable t) {
}
}
}
}
Last edited by xAlan; 22-01-12 at 08:00 PM.
Nothing're Special :(
Bumb !
Nothing're Special :(