1 Reply Latest reply on May 24, 2010 5:00 PM by RicardoFressa

    Error finding class sqlserver 2008 R2

    RicardoFressa

      Hello, when I access my java class through the BlazeDS is falling because the catch is not finding the class of SqlServer 2008 R2 ...
      But I add it to the libs directory of my project files and sqljdbc.jar sqljdbc4.jar, but still keeps giving error ...

      What do I need to install this class in my project?

      My connection class:

       

      package br.com.ricardo.bancojavaflexblazeds;

       

      import java.sql.*;

       

      import javax.swing.JOptionPane;

       

      public class ServicoJavaPessoa {

       

      public void listar_pessoas(){

       

      String driver = "com.microsoft.jdbc.sqlserver.SQLServerDriver";

      String url = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=flex";

      String usuario = "Ricardo-PC\\Ricardo";

      String senha = "";

      Connection conexao;

      Statement statement;

      ResultSet resultset;

       

      try

      {

      Class.forName(driver);

      conexao = DriverManager.getConnection(url, usuario, senha);

      JOptionPane.showMessageDialog(null, "Conexão efetuada com sucesso!");

      }

      catch(ClassNotFoundException Driver)

      {

      JOptionPane.showMessageDialog(null, "Classe do banco de dados não encontrada "+Driver);

      }

      catch(SQLException Banco)

      {

      JOptionPane.showMessageDialog(null, "Erro ao manipular o banco de dados "+Banco);

      }

      }

       

       

      }