package net.sourceforge.javydreamercsw.mysql.driver;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.logging.Logger;
import org.netbeans.api.db.explorer.DatabaseException;
import org.netbeans.api.db.explorer.JDBCDriver;
import org.netbeans.api.db.explorer.JDBCDriverManager;
import org.openide.modules.ModuleInstall;
import org.openide.util.Exceptions;
import org.openide.windows.WindowManager;

public class Installer extends ModuleInstall {

    public static final String mysqlDriverClass = "com.mysql.jdbc.Driver";
    private static final Logger LOG =
            Logger.getLogger(Installer.class.getCanonicalName());

    @Override
    public void restored() {
        WindowManager.getDefault().invokeWhenUIReady(new Runnable() {
            @Override
            public void run() {
                //Check drivers
                if (JDBCDriverManager.getDefault().getDrivers(mysqlDriverClass).length == 0) {
                    try {
                        LOG.fine("Registering MySQL driver!");
                        JDBCDriverManager.getDefault().addDriver(
                                JDBCDriver.create("mysql", "MySQL",
                                mysqlDriverClass,
                                new URL[]{new URL(
                            "nbinst:/modules/ext/com.validation.manager.mysql/1/mysql/mysql-connector-java.jar")}));
                    } catch (DatabaseException ex) {
                        Exceptions.printStackTrace(ex);
                    } catch (MalformedURLException ex) {
                        Exceptions.printStackTrace(ex);
                    }
                }
            }
        });
    }
}

@@ -498,32 +498,22 @@
  String 
-mysqlDriverClass
+DRIVER
  = %22com.
@@ -518,16 +518,19 @@
 m.mysql.
+cj.
 jdbc.Dri
@@ -570,18 +570,16 @@
 gger LOG
- =
 %0A       
@@ -582,16 +582,18 @@
         
+ =
  Logger.
@@ -740,82 +740,16 @@
 ady(
-new Runnable() %7B%0A            @Override%0A            public void run() %7B%0A   
+() -%3E %7B%0A
     
@@ -756,17 +756,16 @@
         
- 
 //Check 
@@ -772,20 +772,16 @@
 drivers%0A
-    
         
@@ -830,32 +830,22 @@
 Drivers(
-mysqlDriverClass
+DRIVER
 ).length
@@ -849,28 +849,24 @@
 gth == 0) %7B%0A
-    
             
@@ -895,20 +895,16 @@
         
-    
 LOG.fine
@@ -934,20 +934,16 @@
 ver!%22);%0A
-    
         
@@ -1016,36 +1016,32 @@
                 
- 
-   
 JDBCDriver.creat
@@ -1096,26 +1096,24 @@
     
-mysqlDriverClass,%0A
+    DRIVER,%0A    
     
@@ -1159,16 +1159,36 @@
 ew URL(%0A
+                    
         
@@ -1304,36 +1304,32 @@
                 
-    
 %7D catch (Databas
@@ -1343,99 +1343,10 @@
 ion 
-ex) %7B%0A                        Exceptions.printStackTrace(ex);%0A                    %7D catch (
+%7C 
 Malf
@@ -1365,28 +1365,24 @@
 ption ex) %7B%0A
-    
             
@@ -1425,30 +1425,8 @@
 x);%0A
-                    %7D%0A
     

Use correct driver class as the old one is being deprecated.