Ariba Tech Solutions’ Web Development Training
Ariba Tech Solutions will be conducting a series of Web Development Training this January 2012. For more details, please visit http://aribawebdevtraining.eventbrite.com/

Connecting Java Applications to MySQL Database
So you’re creating a Java application and want it to work and get connected to a MySQL database. Here’s a quick tutorial on how to get your Java App working with MySQL database.
First, you need to identify your MySQL connection properties like your host address, username, password and database name (assuming that you have your MySQL already up and running.) Also, make sure that you have your Java MySQL Connector installed in your Java JDK library path. You can download Java MySQL Connector here, if you do not have one.
Now, having those information, you need to initiate a new instance of the Java MySQL Connector using these lines:
Class.forName(“com.mysql.jdbc.Driver”).newInstance();
conn = DriverManager.getConnection (ConnectionURL, dbUsername, dbPassword);
You can replace the parameters for the connection for example:
String ConnectionURL = “jdbc:mysql://hostAddress/dbName”;
… where hosAddress is your MySQL host address and dbName for your database name. For example, if you have your MySQL running under localhost (or IP Address if you have it somewhere else) and you want to connect to accounts database, you can connect with this:
String ConnectionURL = “jdbc:mysql://localhost/account”;
PHP/MySQL Quick Cheat Sheet
- Download and install WAMP (Windows Apache MySQL PHP) Server at www.wampserver.com/en or you can use other server package that supports MySQL and PHP applications (ex. AppServ, LAMP, etc.)
- Once installed, make sure that your localhost is up and running and try to access http://localhost
- Read the manual on how to create and where to save your PHP webpages. For WAMP, go to the installation directory and locate the “www” folder.
- Enjoy creating dynamic web applications using PHP & MySQL.
COMMON PHP/MYSQL FUNCTIONS: Read more…


Hi! I am Jerome Locson from Zamboanga City, Philippines. I am programmer, web developer and designer, technopreneur, and blogger. I blog about technology, foods and my travel. Thank you for visiting!