Olá pessoal…
Estou desenvolvendo uma aplicação com CDC utilizando a IDE NetBeans e quando tento criar a classe de conexao com o banco de dados:
classe:
public class Conexao {
private Connection connection = null;
private String serverName = "localhost";
private String mydatabase = "database";
private String url = "jdbc:mysql://" + serverName + "/" + mydatabase; // a JDBC url
private String username = "usuario";
private String password = "senha";
public Conexao() throws ClassNotFoundException, SQLException{
try{
final String driverName = "org.gjt.mm.mysql.Driver"; // MySQL MM JDBC driver
Class.forName(driverName);
connection = (Connection) DriverManager.getConnection(url, username, password);
}catch (Exception e){
e.printStackTrace();
}
}
retorna o seguinte erro:
Created dir: C:\TCC2\Sistema\tcc\build\jnlp
run:
java.lang.SecurityException: Prohibited package name: java.sql
at java.lang.ClassLoader.defineClass(ClassLoader.java:556)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:252)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(AccessController.java:332)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188 )
at java.lang.ClassLoader.loadClass(ClassLoader.java:320)
at java.lang.ClassLoader.loadClass(ClassLoader.java:310)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:401)
at java.lang.ClassLoader.loadClass(ClassLoader.java:263)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:333)
at rafael.tcc.business.UsuarioBusiness.getUsuario(UsuarioBusiness.java:15)
at rafael.tcc.view.Login.Entrar(Login.java:170)
at rafael.tcc.view.Login.btEntrarMouseClicked(Login.java:122)
at rafael.tcc.view.Login.access$100(Login.java:18 )
at rafael.tcc.view.Login$2.mouseClicked(Login.java:63)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:223)
at java.awt.Component.processMouseEvent(Component.java:3070)
at java.awt.Component.processEvent(Component.java:2895)
at java.awt.Container.processEvent(Container.java:895)
at java.awt.Component.dispatchEventImpl(Component.java:2409)
at java.awt.Component.dispatchEvent(Component.java:2313)
at java.awt.LightweightDispatcher.retargetMouseEvent(LightweightDispatcher.java:237)
at java.awt.LightweightDispatcher.processMouseEvent(LightweightDispatcher.java:123)
at java.awt.LightweightDispatcher.dispatchEvent(LightweightDispatcher.java:50)
at java.awt.Window.dispatchEventImpl(Window.java:233)
at java.awt.Component.dispatchEvent(Component.java:2313)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:295)
at java.awt.EventQueueProxy.dispatchEvent(EventDispatchThread.java:286)
at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:98 )
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:88 )
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:83)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:74)
at java.lang.Thread.startup(Thread.java:753)