Error executing the plugin connection to the database [message #28969] |
Thu, 23 October 2008 17:44 |
raphael Messages: 16 Registered: July 2009 |
Junior Member |
|
|
Ola .. I am developing my first plugin ... (very good to do this, but a
little tricky), I am already several days trying to find the cause of the
error, I've done a lot and I can not get to my goal. The plugin is to just
do a test connection with some databases. Thus did a screen test for and
worked, however, when I put this screen to operate within the plugin does
not work. Posted the code responsible for that connection, it is not
possible to interpret, I understand, just show me where I can get my
references for this project.
The first error is classic: ClassNotFoundException
I believe that this error is responsible for others to mention.
- NativeMethodAccessorImpl.invoke0 (Method, Object, Object []) line: not
available [native method]
- DelegatingMethodAccessorImpl.invoke (Object, Object []) line: not
available
public class Conexao{
public void conectar (String driver,String url, String usuario, String
senha) {
try {
Class.forName(driver);
Connection conn = DriverManager.getConnection(url , usuario, senha );
System.out.println ("conexao ok");
JOptionPane.showMessageDialog(null, "Conexão bem Sucedida","OK"
,JOptionPane.INFORMATION_MESSAGE);
} catch (ClassNotFoundException e) {
System.out.println (e.getMessage());
JOptionPane.showMessageDialog(null, "Classe não Encontrada","Erro"
,JOptionPane.ERROR_MESSAGE);
}catch (SQLException e) {
System.out.println("SQLException: " + e.getMessage());
System.out.println("SQLState: " + e.getSQLState());
System.out.println("VendorError: " + e.getErrorCode());
JOptionPane.showMessageDialog(null, "Erro ","Erro"
,JOptionPane.ERROR_MESSAGE);
}catch(Exception e){
System.out.println("Problemas ao tentar conectar com o banco de dados:
" + e);
JOptionPane.showMessageDialog(null, "Não foi possível conetar ao
banco","OK"
,JOptionPane.ERROR_MESSAGE);
}
}
}
[code]
public void handleEvent(Event event) {
Conexao conexao = new Conexao();
conexao.conectar(comboDriver.getText(),
comboURL.getText(),txtUsuario.getText(),txtSenha.getText());
[code]
|
|
|
Powered by
FUDForum. Page generated in 0.02414 seconds