Hello everyone!
Today im ganna teach you how to add a MySQL Intergration to your server.
What we will be needing:
A MySQL Server - I suggest downloading xampp, It is a Webserver and MySQL Server in one! - Download Here
A RSPS - You'll need a Delta Scape base for this tutorial
Some basic Java knowledge - I wont be explaining everything in this tutorial, so if you want to add your own things, you'll need to know some basics
Let's Start.
assuming you have downloaded, installed, started Xampp, and started the MYSQL Server.
Download the following file and add it to your server directorie: Download Now
And also add this folder to your Server Directory: Download Now
After adding this, open server.java.
Now declare the following between between the rest of the public int's booleans etc.:
Code:
public static SQLHandler SQLHandler = new SQLHandler();
Now Open client.java.
Declare the following between all the public int's booleans ETC.:
Now search for:
And underneath it add:
Code:
if(!playerName.equalsIgnoreCase("null"))
server.SQLHandler.SQLLoad1(playerName, this);
This query will check if the user is in the Database, and also get's his ID and inserts it in the public int userID..
Next Search for:
You will see:
Code:
if (command.startsWith("changepassword") && command.length() > 15) {
playerPass = command.substring(15);
sM("Your new pass is \""+command.substring(15)+"\"");
}
or something like it.
Replace it with:
Code:
if (command.startsWith("changepassword") && command.length() > 15) {
playerPass = command.substring(15);
sM("Your new pass is \""+command.substring(15)+"\"");
server.SQLHandler.SQLUpdate1(playerPass);
}
Now. youve added a MySQL intergration to your server.
What we need to do now is add the Table in the database.
Assuming you have alread created a Database:
go to:
http://localhost/phpmyadmin
Login.
Click on the correct database.
Then click on the "SQL" tab at the top
And in the white box add the folowing:
Code:
CREATE TABLE `users` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`username` VARCHAR(20) NOT NULL,
`password` VARCHAR(45) NOT NULL,
PRIMARY KEY (`id`)
)
ENGINE = InnoDB;
Now your done!
You have successfully added a MySQL intergration to your server.