Problem with sql

Limited support for the previous versions of L2jServer. All new work and bug fixes will be on the current release.
Forum rules
READ NOW: L2j Forums Rules of Conduct

Problem with sql

Postby Bigi » Thu Oct 20, 2011 9:51 pm

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:
User avatar
Bigi
 
Posts: 19
Joined: Sun Oct 16, 2011 10:37 pm

Re: Problem with sql

Postby Tryskell » Fri Oct 21, 2011 6:13 pm

Consider to give FAR more details, cause like that... It means nothing :P.

Gl anyway :P.
User avatar
Tryskell
Advanced User
Advanced User
 
Posts: 219
Joined: Wed Nov 25, 2009 6:57 pm
Location: France :)

Re: Problem with sql

Postby Bigi » Fri Oct 21, 2011 10:13 pm

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
User avatar
Bigi
 
Posts: 19
Joined: Sun Oct 16, 2011 10:37 pm

Re: Problem with sql

Postby Tryskell » Sat Oct 22, 2011 5:18 am

There's a lot of exemples everywhere. Search for that sort of codes. And understand how work mySQL queries.

  1.         Connection con = null;
  2.         try
  3.         {
  4.             con = L2DatabaseFactory.getInstance().getConnection();
  5.             PreparedStatement statement = con.prepareStatement("write your SQL query here");
  6.             ResultSet result = statement.executeQuery();
  7.  
  8.             while (result.next())
  9.             {
  10.                 // Do your blabla here (based on your previous query, it must refer to each player)
  11.             }
  12.             result.close();
  13.             statement.close();
  14.         }
  15.         catch (Exception e)
  16.         {
  17.             _log.log(Level.SEVERE, "Error on blabla: ", e);
  18.         }
  19.         finally
  20.         {
  21.             try { con.close(); } catch (Exception e) {}
  22.         }
User avatar
Tryskell
Advanced User
Advanced User
 
Posts: 219
Joined: Wed Nov 25, 2009 6:57 pm
Location: France :)


Return to Legacy Server Support

Who is online

Users browsing this forum: No registered users and 2 guests

cron