Eclipse does not find source code for sqljdbcJar

0

My code works fine, I can start the connection to the database and everything else without problems. But at the time of creating a statement:

Statement stmt = conexao.createStatement();

I get the following error:

Thisoccurswithinmy"ObjectXDAO" class when making a simple select.

package DAO;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;

import javax.print.attribute.SetOfIntegerSyntax;

import model.ModeloX;

//Exemplo de conexão em uma tabela X

public class tabelaXDAO {

    private Connection conexao;
    private Connection conex;

    public tabelaXDAO(Connection conexao){
        this.conexao = conexao;
    }

    public ModeloX objetoPorId(int id) {
        String sql;
        sql="Select "
                + "colunaId, "
                + "colunaDesc, "
                + "colunaVal "
                + "from teste "
                + "where colunaId= 1 ";

        PreparedStatement ps;
        try {
            //ps = conexao.prepareStatement(sql);
            //ps.setInt(1,id);
            Statement stmt = conexao.createStatement();
            ResultSet rs = stmt.executeQuery(sql);
            if(rs.next()) {
                ModeloX mx;
                mx = new ModeloX();
                mx.setId(rs.getInt("colunaId"));
                mx.setDesc(rs.getString("colunaDesc"));
                mx.setVal(rs.getFloat("colunaVal"));
                return mx;
            }
        }catch(Exception ex) {
            throw new DAOException("Ocorreu um erro no select do objeto");
        }

        return null;
    }


}

If I paste this sql snippet exactly as it is it works without problems.

Thank you in advance.

Edit: my VM arguments: Apache Software Foundation \ Tomcat 8.5 "-Dcatalina.home=" C: \ Program Files (x86) \ Apache Software Foundation \ Tomcat 8.5 "-Dwtp.deploy = C: \ Program Files (x86) \ Apache Software Foundation \ Tomcat 8.5 \ webapps "-Djava.library.path=" C: \ eclipse Oxygen \ jdk \ bin "-Djava.endorsed.dirs=" C: \ Program Files x86) \ Apache Software Foundation \ Tomcat 8.5 \ endorsed "

>

    
asked by anonymous 01.02.2018 / 19:44

0 answers