Wednesday, 2 December 2015

THE JAVA MYSQL CONNECTION CLASS

Problems in your database connectivity?
Here is the solution .For those using netbeans Here is the class


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

public class CreateDB
{
    public static  Connection getConnection()
    {
        String driver="com.mysql.jdbc.Driver";
        String url="jdbc:mysql://localhost:3306/tax";//name of the database(tax)
        String username="root";
        String password="";
        try {
            Class.forName(driver);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(CreateDB.class.getName()).log(Level.SEVERE, null, ex);
        }
        Connection con = null;
        try {
            con = (Connection) DriverManager.getConnection(url,username,password);
        } catch (SQLException ex) {
            Logger.getLogger(CreateDB.class.getName()).log(Level.SEVERE, null, ex);
        }
        return con;
    }  
}

Thursday, 26 November 2015

PROGRAMING

For all the programmers out there here is what you have been waiting for.
Now you can be able to get all the knowledge about computer programming and all your code snippets
right here for free of charge