How to access the MySql using servlet....
Now am using Mysql 5.0 & MyOdbc 3.51
What type of connector to be used?...
We used the following syntax..is it correct?or not?

Connection cn=DriverManager.getConnection("jdbc:mysql://","root","erp");

Whenever i execute this program i got the error like this
ClassNotFoundException: org.gjt.mm.mysql.Driver

because ("com.mysql.jdbc.Driver") is a correct driver name

Instead of using MyODBC 3.51 use MySQL JDBC Driver - mysql-connector-java-5.1.6-bin

Then use the following servlet code:

import javax.swing.*;
import java.sql.*;

public class Database {

    private Connection connection;
    private static String databaseName = "";
    private static String databaseUsername = "";
    private static String databasePassword = "";
    private static String driver = "com.mysql.jdbc.Driver";

    public Connection getConnection() {
        return connection;

    public void createConnection() {
        if (connection == null) {
            try {
                String url = "jdbc:mysql://localhost/" + databaseName;

                connection = DriverManager.getConnection(
                        url, databaseUsername, databasePassword);

            } catch (Exception e) {
                JOptionPane.showMessageDialog(new JFrame(),
                        "Database connection could not be established." +
                        "Please check your network connection and restart.",
                        "Error Message", JOptionPane.ERROR_MESSAGE);
                connection = null;