[HELP] Community server query GS database

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
thaiscorpion
Posts: 30
Joined: Thu Sep 01, 2011 3:57 am

[HELP] Community server query GS database

Post by thaiscorpion »

L2J Community Server version=4912M

Hello, ive got i little problem:

im trying to query the gameserver database from the community server :

Code: Select all

private void loadFromDB(int type) {      java.sql.Connection con = null;      String top;      if (type==0)         top = "database_stat1";      else         top = "database_stat2";      try      {         _posId = 0;         con = L2DatabaseFactory.getInstance().getConnection();         PreparedStatement statement = con.prepareStatement("SELECT c.char_name, c.base_class, c."+top+", c.level, c.online, cl.clan_name, cl.ally_name FROM characters c LEFT JOIN clan_data cl ON cl.clan_id=c.clanid WHERE c.accesslevel=0 ORDER BY c."+top+" DESC, c.char_name ASC LIMIT 10");       }
But this connects to my "l2jcs" databse ad obviusly there isnt any tables called characters, how can i modify this to connect to my "l2jgs"? ty any help would be great
User avatar
tukune
Posts: 533
Joined: Sun Mar 29, 2009 2:35 pm
Location: Japan

Re: [HELP] Community server query GS database

Post by tukune »

:evil: con = L2DatabaseFactory.getInstance().getConnection();
:D con = java.sql.DriverManager.getConnection("jdbc:mysql://localhost/l2jgs", "root", "your password");
Post Reply