PDA

View Full Version : db.ini


n00b8472
02-14-2002, 09:28 PM
Why doesn't the linux servers use the info from db.ini? Every time I try to start up chat/world/zone I get 'Failed to connect to database: Error: Access denied for user: 'eq@localhost' (Using password: YES)

However, in my db.ini I have another user defined (namely the user that works with mysql) but the server doesn't seem to read this file at all.. wtf?

misanthropicfnd
02-15-2002, 12:37 AM
At the moment the executables built on linux use the login & db info statically defined in dbconnectinfo.linux.txt. Try changing this file & rebuilding.

theCoder
02-15-2002, 04:07 PM
It's not too hard to modify the code to read the db.ini file. I do it with every release I download (and since it's not so hard, I really don't know why the Linux version has this terrible hack).

These steps have worked for me so far, but I haven't had time to look at 0.2.3, so YMMV.

First, edit the common/database.h file and remove the ifdef's around the 2 constructors for the Database class (you can leave both constructors in if you want, or remove the constructor that takes no parameters).

Now edit the common/database.cpp and take out the ifdef's there as well. Now go through and change every instance of stricmp to strcasecmp and every instance of strnicmp to strncasecmp. If you feel like it, you can add #define's in the windows ifdef at the top mapping them back to the original, but if you're not going to compile on windows, don't worry about it.

Not edit every net.cpp you can find. They almost all have an ifdef section that defines the Database object different based on windows or Linux build. Take the Windows version of the database definition out of the ifdef and delete the Linux version. Remove any #include's of the silly text file hack (not necessary, but you don't need it).

Now when you compile and run, the programs will use the db.ini file. The only caveat is that the db.ini file has to be in the same directory as the binary. I usually just copy all the binaries to a new directory called bin and keep everything there (I actually modify the makefiles to build to ../bin/program_name instead of to just program_name).

If you want, you can reference my port of 0.2.0 in this thread: http://forums.eqemu.net/showthread.php?s=&threadid=114.