0

So I´ve been struggling with the JDBC driver to get my MySQL database running in my Android application. It´s a simple application that I have to make for school but I keep getting NullPointers at the Connection class.

I tested the connection in a regular Java project in Netbeans and that works fine.

Here is my code:

private Connection conn;

public data_Administration dataAdministration = data_Administration.getInstance();

public data_SQL()
{
    this.connectToDatabase();
}

protected void connectToDatabase()
{
    try
    {
        try
        {
            Class.forName("com.mysql.jdbc.Driver");
        }
        catch(Exception ee)
        {

        }

    }
    catch(Exception eee)
    {

    }
    try
    {
        conn = DriverManager.getConnection("jdbc:mysql://db4free.net:3306/", ****, ****);
    }
    catch (SQLException ex)
    {

    }
}

0 Answers0