IndianWebPortal.com

Something Different In Linux

Home » Email Marketing Series » mysql connection in jsp

mysql connection in jsp

Posted by Rishikesh Vispute Categories: Email Marketing Series, How to, mysql, Tomcat

Database Connection by using jsp page .

The URL based mysql connection  is

=================================

jdbc:mysql://serverip address/DATABASENAME?user=USERNAME&password=PASSWORD

=================================

OR

=================================

<!– Database connection settings –>
<property name=”connection.driver_class”>com.mysql.jdbc.Driver</property>

<property name=”connection.url”>jdbc:mysql://localhost/database_name</property>
<property name=”connection.username”>databses_user</property>
<property name=”connection.password”>password</property>

<!– configuration pool via c3p0–>

=================================

OR

=================================

try {
   	Class.forName("com.mysql.jdbc.Driver").newInstance();
 	// here we are connecting to localhost, port 3306.  Change it to your db server address:port
 	con = DriverManager.getConnection("jdbc:mysql://localhost:3306/databaseName",
         	"root", "secret");
 	//or  con = DriverManager.getConnection("jdbc:mysql://localhost:3306/databaseName?user=
 		root&password=secret";
 }
 catch(Exception e){
 		System.out.println(e.getMessage());
 	}
=================================

Popular Posts

remove index.php fro

How to remove index.php from url in magento Ans : If you ...

PHP-Java bridge on p

  What is php-java bridge? The php-java bridge is the php ...

Set expiration for y

If you want to set the expiration to your site ...

Warning: Parameter 1

Error: Warning: Parameter 1 to modMainMenuHelper::buildXML() expected to be a ...

domain pointing to e

If you domain uses external MX record and it is ...