Hello, I am just starting to use Java to connect to sql and i have a question
Where can i find codes showing how to get the java program to connect to the sql server and "alter / add" stuff to the table/database
Like for instance, in php you would use this
Code:
<?php
$dbhost = "localhost";
$dbname = "helloworld";
$dbuser = "root";
$dbpass = "";
//Connect to database
mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());
Now to add a User to the database it would use this code
Code:
$query = "INSERT INTO users (CurrentEnergy, MaxEnergy, CurrentStamina, MaxStamina, Experience, Level, name, email, username, password)
VALUES('10', '10', '3', '3', '0', '1', '$name', '$email', '$username', '$password')";
mysql_query($query) or die(mysql_error());
mysql_close();
I am simply wondering how you would go about doing this in java, the php codes above are based from a php game i was in the process of creating.
Thanks for the help, and i don't want links to tutorials how to configure it for runescape private server's because i am using my own framework, that will be released when i feel like it is stable enough.