Create a new Database Connection in JSP By: Erobo Team Member
Hire a Developer for Related Work / Installation | $55 hr
Average Votes: (1901)
This article explains how to set up a database connection using Mysql and JSP.
In this tutorial we will learn how to create a JSP / Mysql database connection using the com.mysql.jdbc.Driver.
The script first defines basic db login information such as username and password. Then it creates an object of type com.mysql.jdbc.Driver. Next you are able to use the driver manager to request a new JDBC connection. This in turn will allow you to execute any type of query on your database.
String dbhost = "10.10.10.10"; //your db host address here
String dbname = "MyNewDatabase"; //your db name here
String dbuser = "Myusername"; //your db user here
String dbpass = "Mypassword"; //your db password here