Page 1 of 1

Problem with sql

Posted: Thu Oct 20, 2011 8:51 pm
by Bigi
L2J Revision Number: L2J Interlude
L2JDP Revision Number: L2J Interlude

Hi all. I have a some problem with sql. Who can help?
How to write inquiry for loading from base of a variable for each character?

Sorry for my English :lol:

Re: Problem with sql

Posted: Fri Oct 21, 2011 5:13 pm
by Tryskell
Consider to give FAR more details, cause like that... It means nothing :P.

Gl anyway :P.

Re: Problem with sql

Posted: Fri Oct 21, 2011 9:13 pm
by Bigi
Tryskell wrote:Consider to give FAR more details, cause like that... It means nothing :P.

Gl anyway :P.
I need only code of loading a parameter from database. I want to load for each characters a parameter, which influences on a chance of level up of soul crystals. I want to place this code to L2Attackable.java


Sorry for my English :P

Re: Problem with sql

Posted: Sat Oct 22, 2011 4:18 am
by Tryskell
There's a lot of exemples everywhere. Search for that sort of codes. And understand how work mySQL queries.

Code: Select all

        Connection con = null;        try        {            con = L2DatabaseFactory.getInstance().getConnection();            PreparedStatement statement = con.prepareStatement("write your SQL query here");            ResultSet result = statement.executeQuery();             while (result.next())            {                // Do your blabla here (based on your previous query, it must refer to each player)            }            result.close();            statement.close();        }        catch (Exception e)        {            _log.log(Level.SEVERE, "Error on blabla: ", e);        }        finally        {            try { con.close(); } catch (Exception e) {}        }