Jump to content

Fix DB Startup Error


Faby

Recommended Posts

Hi, this tutorial will solve thist error : http://metin2dev.org/board/topic/2588-40k-db-error-on-startup-sometimes/#entry18151

 

 

 First of all, the bug happens when the DB tries to set the locale char set, so let's start.

 

Open path_to_your_source/db/src/ClientManager.cpp (in my case  /usr/src/mainline_released/Srcs/Sever/db/src and search your country,

 

 if you use locale/germany search germany, locale/romania search romania, locale/spain search spain,..

 

And look for g_stLocale = "latin2";.  in my case is latin2 because i use romania, you musn't forgot your charset during the tutorial.

 

Now open main.cpp, and edit:

std::string g_stLocale = "euckr";

with your charset, in my case:

std::string g_stLocale = "latin2";

Save and exit.

 

Now open, path_to_your_source/libsql/AsyncSQL.cpp  ( libsql  no libmysql be careful)

 

At line 180 edit:

 

m_stLocale = c_pszLocale;
 
with:
 
 
m_stLocale = "latin2";     ( in my case latin2, you need to put your charset)
 

And at the end of the file edit:

 

void CAsyncSQL2::SetLocale(const std::string & stLocale)
{
m_stLocale = stLocale;
QueryLocaleSet();
}
 
 
with:
 
void CAsyncSQL2::SetLocale(const std::string & stLocale)
{
if(m_stLocale != stLocale)
{
m_stLocale = stLocale;
QueryLocaleSet();
}
}
Now, compile.
In putty or virtualbox put the next commands:
 
cd /path_to_your_source/libsql    in my case  cd /usr/src/mainline_released/Srcs/Sever/libsql


gmake clean


gmake
 
After that :
 
cd /path_to_your_source/db/src


gmake clean


After the clean, open the folder .obj and verify if is empty, if isn't empy, empty it delete all files.


After that


gmake

Now the last step, open navicat connect to your server

and on the databases  account, common, player, hotbackup and log,  right-click->Database properties.

 
Set your character set: latin1, latin2, latin5
 
And collation: I use general but if you fin your country you can put it.
 
 
That was all, and sorry for my english.
 
 
 

 

 

  • Not Good 1
  • Love 1
  • Love 16
Link to comment
Share on other sites

 

Hi, this tutorial will solve thist error : http://metin2dev.org/board/topic/2588-40k-db-error-on-startup-sometimes/#entry18151

 

 

 First of all, the bug happens when the DB tries to set the locale char set, so let's start.

 

Open path_to_your_source/db/src/ClientManager.cpp (in my case  /usr/src/mainline_released/Srcs/Sever/db/src and search your country,

 

 if you use locale/germany search germany, locale/romania search romania, locale/spain search spain,..

 

And look for g_stLocale = "latin2";.  in my case is latin2 because i use romania, you musn't forgot your charset during the tutorial.

 

Now open main.cpp, and edit:

std::string g_stLocale = "euckr";

with your charset, in my case:

std::string g_stLocale = "latin2";

Save and exit.

 

Now open, path_to_your_source/libsql/AsyncSQL.cpp  ( libsql  no libmysql be careful)

 

At line 180 edit:

 

m_stLocale = c_pszLocale;
 
with:
 

 

m_stLocale = "latin2";     ( in my case latin2, you need to put your charset)
 

And at the end of the file edit:

 

void CAsyncSQL2::SetLocale(const std::string & stLocale)
{
m_stLocale = stLocale;
QueryLocaleSet();
}
 
 
with:
 

if(m_stLocale != stLocale)
{
m_stLocale = stLocale;
QueryLocaleSet();
}
Now, compile.
In putty or virtualbox put the next commands:
 

cd /path_to_your_source/libsql    in my case  cd /usr/src/mainline_released/Srcs/Sever/libsql


gmake clean


gmake
 
After that :
 

cd /path_to_your_source/db/src


gmake clean


After the clean, open the folder .obj and verify if is empty, if isn't empy, empty it delete all files.


After that


gmake

Now the last step, open navicat connect to your server

and on the databases  account, common, player, hotbackup and log,  right-click->Database properties.

 
Set your character set: latin1, latin2, latin5
 
And collation: I use general but if you fin your country you can put it.
 
 
That was all, and sorry for my english.

 

i have error. 

 

fixed

 

this is not work wtf?

  • Love 1
Link to comment
Share on other sites

  • Honorable Member

Doesn't work for me :S

 

First start

Second start

 

It pisses me off when I restart my PC I can start the db again by once.

 

It's works!

I forgot to save the AsyncSQL.cpp file changes in Notepad++ -_- x'Đ

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

Just use this MakeFile:

MAKE = gmake
CC = g++

INCDIR =
LIBDIR =
BINDIR = ..
OBJDIR = .obj
LIBDIR += -L/usr/local/lib/mysql

GCC_VERSION = $(shell $(CC) --version 2>&1 | grep "(GCC)" | cut -d' ' -f3  | cut -d'.' -f1)
BSD_VERSION = $(shell uname -v 2>&1 | cut -d' ' -f2 | cut -d'.' -f1)
P4_VERSION = 40146
$(shell if [ ! -d $(OBJDIR) ]; then mkdir $(OBJDIR); fi)

TARGET = $(BINDIR)/db_r$(P4_VERSION)

CFLAGS = -g -Wall -O2 -pipe -fno-rtti -fno-exceptions -pthread -D_THREAD_SAFE

ifeq ($(GCC_VERSION), 4)
CFLAGS += -mtune=i686
else
CFLAGS += -mcpu=i686
endif

# boost
INCDIR += -I../../boost

LIBDIR += -L../../libthecore/lib -L../../libsql -L../../libpoly -L../../libgame/lib

ifeq ($(BSD_VERSION), 7)
INCDIR += -I../../libmysql/7.x-5.1.35
LIBDIR += -L../../libmysql/7.x-5.1.35
else
INCDIR += -I../../libmysql/5.x-5.1.35
LIBDIR += -L../../libmysql/5.x-5.1.35
endif

LIBS = -lthecore -lmysqlclient -lsql -lpoly -lgame -lm -lz

SRCS =	Config.cpp NetBase.cpp Peer.cpp PeerBase.cpp Main.cpp Lock.cpp DBManager.cpp 
		Cache.cpp LoginData.cpp ClientManager.cpp ClientManagerPlayer.cpp ClientManagerLogin.cpp 
		ClientManagerBoot.cpp ClientManagerParty.cpp ClientManagerGuild.cpp GuildManager.cpp HB.cpp 
		PrivManager.cpp MoneyLog.cpp ItemAwardManager.cpp ClientManagerEventFlag.cpp Marriage.cpp 
		Monarch.cpp BlockCountry.cpp ItemIDRangeManager.cpp ClientManagerHorseName.cpp version.cpp 
		AuctionManager.cpp ProtoReader.cpp CsvReader.cpp 

OBJS = $(SRCS:%.cpp=$(OBJDIR)/%.o)

default: $(TARGET)

$(TARGET): $(OBJS)
	@echo linking ...
	@$(CC) $(CFLAGS) $(LIBDIR) $(OBJS) $(LIBS) -o $(TARGET)
	@touch version.cpp

$(OBJDIR)/%.o: %.cpp
	@echo compile $<
	@$(CC) $(CFLAGS) $(INCDIR) -c $< -o $@

$(OBJDIR)/version.o: version.cpp
	@$(CC) $(CFLAGS) -D__P4_VERSION__="$(P4_VERSION)" -c $< -o $@
	@echo compile $<

$(OBJDIR):
	@mkdir $(OBJDIR)

clean:
	@rm -f $(OBJS) $(BINDIR)/db_r*

dep:
	@touch Depend
	makedepend -fDepend $(INCDIR) -I/usr/include/c++/3.3 -I/usr/include/c++/4.2 -p$(OBJDIR)/ $(SRCS) 2> /dev/null

sinclude Depend

And edit version.cpp like this:

#include <stdio.h>
#include <stdlib.h>

void WriteVersion()
{
#ifndef __WIN32__
	FILE* fp(fopen("VERSION.txt", "w"));

	if (NULL != fp)
	{
		fprintf(fp, "db revision: 40146n");
		//fprintf(fp, "%s@%s:%sn", __USER__, __HOSTNAME__, __PWD__);
		fclose(fp);
	}
	else
	{
		fprintf(stderr, "cannot open VERSION.txtn");
		exit(0);
	}
#endif
}
After you are able to compile db core.

 

  • Love 1
Link to comment
Share on other sites

  • 4 months later...
  • Premium

Cant Complile

 


AsyncSQL.h: In constructor 'CAsyncSQL::CAsyncSQL()':
AsyncSQL.h:201: warning: 'CAsyncSQL::m_iCopiedQuery' will be initialized after
AsyncSQL.h:175: warning:   'int CAsyncSQL::m_iPort'
AsyncSQL.cpp:19: warning:   when initialized here
AsyncSQL.cpp: At global scope:
AsyncSQL.cpp:712: error: expected `)' before '{' token
AsyncSQL.cpp: In member function 'void CAsyncSQL2::SetLocale(const std::string&)':
AsyncSQL.cpp:713: error: 'stLocale' was not declared in this scope
Makefile:41: recipe for target 'AsyncSQL.o' failed
gmake[1]: *** [AsyncSQL.o] Error 1
gmake[1]: Leaving directory '/usr/wolfman_branch/wolf/Srcs/Server/libsql'
Makefile:25: recipe for target 'default' failed
gmake: *** [default] Error 2

Link to comment
Share on other sites

 

Just use this MakeFile:

MAKE = gmake
CC = g++

INCDIR =
LIBDIR =
BINDIR = ..
OBJDIR = .obj
LIBDIR += -L/usr/local/lib/mysql

GCC_VERSION = $(shell $(CC) --version 2>&1 | grep "(GCC)" | cut -d' ' -f3  | cut -d'.' -f1)
BSD_VERSION = $(shell uname -v 2>&1 | cut -d' ' -f2 | cut -d'.' -f1)
P4_VERSION = 40146
$(shell if [ ! -d $(OBJDIR) ]; then mkdir $(OBJDIR); fi)

TARGET = $(BINDIR)/db_r$(P4_VERSION)

CFLAGS = -g -Wall -O2 -pipe -fno-rtti -fno-exceptions -pthread -D_THREAD_SAFE

ifeq ($(GCC_VERSION), 4)
CFLAGS += -mtune=i686
else
CFLAGS += -mcpu=i686
endif

# boost
INCDIR += -I../../boost

LIBDIR += -L../../libthecore/lib -L../../libsql -L../../libpoly -L../../libgame/lib

ifeq ($(BSD_VERSION), 7)
INCDIR += -I../../libmysql/7.x-5.1.35
LIBDIR += -L../../libmysql/7.x-5.1.35
else
INCDIR += -I../../libmysql/5.x-5.1.35
LIBDIR += -L../../libmysql/5.x-5.1.35
endif

LIBS = -lthecore -lmysqlclient -lsql -lpoly -lgame -lm -lz

SRCS =	Config.cpp NetBase.cpp Peer.cpp PeerBase.cpp Main.cpp Lock.cpp DBManager.cpp 
		Cache.cpp LoginData.cpp ClientManager.cpp ClientManagerPlayer.cpp ClientManagerLogin.cpp 
		ClientManagerBoot.cpp ClientManagerParty.cpp ClientManagerGuild.cpp GuildManager.cpp HB.cpp 
		PrivManager.cpp MoneyLog.cpp ItemAwardManager.cpp ClientManagerEventFlag.cpp Marriage.cpp 
		Monarch.cpp BlockCountry.cpp ItemIDRangeManager.cpp ClientManagerHorseName.cpp version.cpp 
		AuctionManager.cpp ProtoReader.cpp CsvReader.cpp 

OBJS = $(SRCS:%.cpp=$(OBJDIR)/%.o)

default: $(TARGET)

$(TARGET): $(OBJS)
	@echo linking ...
	@$(CC) $(CFLAGS) $(LIBDIR) $(OBJS) $(LIBS) -o $(TARGET)
	@touch version.cpp

$(OBJDIR)/%.o: %.cpp
	@echo compile $<
	@$(CC) $(CFLAGS) $(INCDIR) -c $< -o $@

$(OBJDIR)/version.o: version.cpp
	@$(CC) $(CFLAGS) -D__P4_VERSION__="$(P4_VERSION)" -c $< -o $@
	@echo compile $<

$(OBJDIR):
	@mkdir $(OBJDIR)

clean:
	@rm -f $(OBJS) $(BINDIR)/db_r*

dep:
	@touch Depend
	makedepend -fDepend $(INCDIR) -I/usr/include/c++/3.3 -I/usr/include/c++/4.2 -p$(OBJDIR)/ $(SRCS) 2> /dev/null

sinclude Depend

And edit version.cpp like this:

#include <stdio.h>
#include <stdlib.h>

void WriteVersion()
{
#ifndef __WIN32__
	FILE* fp(fopen("VERSION.txt", "w"));

	if (NULL != fp)
	{
		fprintf(fp, "db revision: 40146n");
		//fprintf(fp, "%s@%s:%sn", __USER__, __HOSTNAME__, __PWD__);
		fclose(fp);
	}
	else
	{
		fprintf(stderr, "cannot open VERSION.txtn");
		exit(0);
	}
#endif
}
After you are able to compile db core.

 

Its not necesary to edit version.cpp ,only makefile.

  • Love 3
Link to comment
Share on other sites

  • 9 months later...

i have a big problem:

 

Wie viele Channels möchtest du starten 

-    (1)    Channel 

-    (2)    Channel 

-    (3)    Channel 

-    (4)    Channel 

- (5Auth 


Serverstarter 

 Startet 
die Datenbank .. 
Real Server 
Log Offlog_file_delete_old
statNo such file or directory 
AsyncSQL
connected to localhost (reconnect 1
Success PLAYER 
AsyncSQL
connected to localhost (reconnect 1
AsyncSQLconnected to localhost (reconnect 1
AsyncSQLconnected to localhost (reconnect 1
Success ACCOUNT 
AsyncSQL
connected to localhost (reconnect 1
AsyncSQLconnected to localhost (reconnect 1
AsyncSQLconnected to localhost (reconnect 1
Success COMMON 
AsyncSQL
connected to localhost (reconnect 1
AsyncSQLconnected to localhost (reconnect 1
AsyncSQLconnected to localhost (reconnect 1
Success HOTBACKUP 
AsyncSQL
connected to localhost (reconnect 1
AsyncSQLconnected to localhost (reconnect 1
 Die 
Datenbank wurde gestartet
 
Startet den Loginserver .. 
PUBLIC_IP51.000.00.000 interface em0 
HOSTNAME
auth 
Character set 
'name2' is not a compiled character set and is not specified in the '/usr/local/share/mysql/charsets/Index.xml' file 
mysql_real_connect
Can't initialize character set name2 (path: /usr/local/share/mysql/charsets/) 
cannot open direct sql connection to host: localhost user: mt2 db: common 
cannot start server while no common sql connected 
 Der Loginserver wurde gestartet[0m 
 Starte game99_1 .. 
PUBLIC_IP: 51.000.00.000 interface em0 
HOSTNAME: channel99_core1 
Character set '
name2' is not a compiled character set and is not specified in the '/usr/local/share/mysql/charsets/Index.xml' file 
mysql_real_connect: Can'
t initialize character set name2 (path: /usr/local/share/mysql/charsets/) 
cannot open direct sql connection to hostlocalhost usermt2 dbcommon 
cannot start server 
while no common sql connected 
 game99 Core 1 wurde gestartet

 
Starte game99_2 .. 
PUBLIC_IP51.000.00.000 interface em0 
HOSTNAME
channel99_core2 
Character set 
'name2' is not a compiled character set and is not specified in the '/usr/local/share/mysql/charsets/Index.xml' file 
mysql_real_connect
Can't initialize character set name2 (path: /usr/local/share/mysql/charsets/) 
cannot open direct sql connection to host: localhost user: mt2 db: common 
cannot start server while no common sql connected 
 game99 Core 2 wurde gestartet. 
 Starte game99_3 .. 
PUBLIC_IP: 51.000.00.000 interface em0 
HOSTNAME: channel99_core3 
Character set '
name2' is not a compiled character set and is not specified in the '/usr/local/share/mysql/charsets/Index.xml' file 
mysql_real_connect: Can'
t initialize character set name2 (path: /usr/local/share/mysql/charsets/) 
cannot open direct sql connection to hostlocalhost usermt2 dbcommon 
cannot start server 
while no common sql connected 
 game99 Core 3 wurde gestartet

 
Starte game99_4 .. 
PUBLIC_IP51.000.00.000 interface em0 
HOSTNAME
channel99_core4 
Character set 
'name2' is not a compiled character set and is not specified in the '/usr/local/share/mysql/charsets/Index.xml' file 
mysql_real_connect
Can't initialize character set name2 (path: /usr/local/share/mysql/charsets/) 
cannot open direct sql connection to host: localhost user: mt2 db: common 
cannot start server while no common sql connected 
 game99 Core 4 wurde gestartet. 
 Starte game99 Core 5 .. 
PUBLIC_IP: 51.000.00.000 interface em0 
HOSTNAME: channel99_core5 
Character set '
name2' is not a compiled character set and is not specified in the '/usr/local/share/mysql/charsets/Index.xml' file 
mysql_real_connect: Can'
t initialize character set name2 (path: /usr/local/share/mysql/charsets/) 
cannot open direct sql connection to hostlocalhost usermt2 dbcommon 
cannot start server 
while no common sql connected 
 game99 Core 5 wurde gestartet

 
Startet Channel 1 Core 1 .. 
PUBLIC_IP51.000.00.000 interface em0 
HOSTNAME
channel1_core1 
Character set 
'name2' is not a compiled character set and is not specified in the '/usr/local/share/mysql/charsets/Index.xml' file 
mysql_real_connect
Can't initialize character set name2 (path: /usr/local/share/mysql/charsets/) 
cannot open direct sql connection to host: localhost user: mt2 db: common 
cannot start server while no common sql connected 
 Channel 1 Core 1 wurde gestartet. 
 Startet Channel 1 Core 2 .. 
PUBLIC_IP: 51.000.00.000 interface em0 
HOSTNAME: channel1_core2 
Character set '
name2' is not a compiled character set and is not specified in the '/usr/local/share/mysql/charsets/Index.xml' file 
mysql_real_connect: Can'
t initialize character set name2 (path: /usr/local/share/mysql/charsets/) 
cannot open direct sql connection to hostlocalhost usermt2 dbcommon 
cannot start server 
while no common sql connected 
 Channel 1 Core 2 wurde gestartet

 
Startet Channel 1 Core 3 .. 
PUBLIC_IP51.000.00.000 interface em0 
HOSTNAME
channel1_core3 
Character set 
'name2' is not a compiled character set and is not specified in the '/usr/local/share/mysql/charsets/Index.xml' file 
mysql_real_connect
Can't initialize character set name2 (path: /usr/local/share/mysql/charsets/) 
cannot open direct sql connection to host: localhost user: mt2 db: common 
cannot start server while no common sql connected 
 Channel 1 Core 3 wurde gestartet. 
 Startet Channel 1 Core 4 .. 
PUBLIC_IP: 51.000.00.000 interface em0 
HOSTNAME: channel1_core4 
Character set '
name2' is not a compiled character set and is not specified in the '/usr/local/share/mysql/charsets/Index.xml' file 
mysql_real_connect: Can'
t initialize character set name2 (path: /usr/local/share/mysql/charsets/) 
cannot open direct sql connection to hostlocalhost usermt2 dbcommon 
cannot start server 
while no common sql connected 
 Channel 1 Core 4 wurde gestartet

 
Startet Channel 1 Core 5 .. 
PUBLIC_IP51.000.00.000 interface em0 
HOSTNAME
channel1_core5 
Character set 
'name2' is not a compiled character set and is not specified in the '/usr/local/share/mysql/charsets/Index.xml' file 
mysql_real_connect
Can't initialize character set name2 (path: /usr/local/share/mysql/charsets/) 
cannot open direct sql connection to host: localhost user: mt2 db: common 
cannot start server while no common sql connected 
 Channel 1 Core 5 wurde gestartet. 



        Channel Gestartet  

Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.