Package com.mysql.jdbc

Examples of com.mysql.jdbc.Connection


        return super.getSession().createQuery("from PipeLineElementDefect").setFirstResult(page.intValue() * 15).setMaxResults(15).list();

    }

    public List getPipeLineElementDefectByPipeLineElement(Integer id, Properties properties) {
        Connection connection = getConnection(properties);
        List list = new ArrayList();
        try {
            ResultSet resultSet = connection.createStatement().executeQuery("select * from pipelineelementdefect where idElement=" + id);

            while (resultSet.next()) {
                PipeLineElementDefect pipeLineElementDefect = new PipeLineElementDefect();
                pipeLineElementDefect.setDefectId((Integer) resultSet.getInt(1));
                pipeLineElementDefect.setDefectType(defectTypeDao.getDefectType((Integer) resultSet.getInt(2)));
View Full Code Here


        getHibernateTemplate().delete(pipeLineElementDefect);
    }

    private Connection getConnection(Properties properties) {
        String driverURL = "jdbc:mysql://localhost/vstbase?useUnicode=true&characterEncoding=UTF-8";
        Connection dbConn = null;
        try {
            Class.forName("com.mysql.jdbc.Driver");
            dbConn = (Connection) DriverManager.getConnection(driverURL, properties);
            return dbConn;
        }
View Full Code Here

    }

    public List getConstructionDefectZonesByConstrType(String typeId,  String buildingObjectId,Properties props) throws SQLException {


        Connection dbConn = getConnection(props);
        Statement st = (Statement) dbConn.createStatement();
        ResultSet rs = (ResultSet) st.executeQuery("select constructionDefectsZone.constructionDefectId from constructionExamples, constructionDefectsZone where constructionExamples.buildObjectId="+buildingObjectId+" and constructionExamples.exampleId=constructionDefectsZone.exampleId and constructionDefectsZone.constructionTypeId="+typeId+" group by uniqueForExamples");
        List plList = setValues(rs);
        rs.close();

        return plList;
View Full Code Here

        return plList;
    }

    public List getExamplesByDefect(String unique,Properties properties) throws SQLException {
        Connection dbConn = getConnection(properties);
        Statement st = (Statement) dbConn.createStatement();
        ResultSet rs = (ResultSet) st.executeQuery("select exampleId from constructionDefectsZone where uniqueForExamples="+unique);
        List list=new ArrayList();
        while (rs.next()) {
              list.add(rs.getString(1));
        }
View Full Code Here

    }

    private Connection getConnection(Properties props) {

           String driverURL = "jdbc:mysql://localhost/vstbase?useUnicode=true&characterEncoding=UTF-8";
           Connection dbConn = null;
           try {
               Class.forName("com.mysql.jdbc.Driver");
               dbConn = (Connection) DriverManager.getConnection(driverURL, props);
               return dbConn;
           }
View Full Code Here

    }

    private Connection getConnection(Properties props) {

            String driverURL = "jdbc:mysql://localhost/vstbase?useUnicode=true&characterEncoding=UTF-8";
            Connection dbConn = null;
            try {
                Class.forName("com.mysql.jdbc.Driver");
                dbConn = (Connection) DriverManager.getConnection(driverURL, props);
                return dbConn;
            }
View Full Code Here

            }
        }

        public List getExamplesWithNoDefects(Integer buildingObjectId, Properties props) throws SQLException {

            Connection dbConn = getConnection(props);
            Statement st = (Statement) dbConn.createStatement();
            System.out.println("select exampleId from constructionExamples where constructionExamples.noDeffects=false and objectConstructionId in (select typeId from objectConstructions where objectId="+buildingObjectId+")");
            ResultSet rs = (ResultSet) st.executeQuery("select exampleId from constructionExamples where constructionExamples.noDeffects=false and objectConstructionId in (select typeId from objectConstructions where objectId="+buildingObjectId+")");
            List list=new ArrayList();
            while (rs.next()) {
                list.add(new Integer(rs.getInt(1)));
            }

            rs.close();
            st.close();
            dbConn.close();
            return list;

        }
View Full Code Here

  
    public int salvar(Usuario o) {
        int ultimaMatricula = 0;
        try //tente
        {
            Connection con = (Connection) ConectaBanco.getConexao();
            PreparedStatement pstmt;


            // Inserir um novo objeto

            pstmt = con.prepareStatement("insert into usuario "
                    + "(usuario, senha)"
                    + "values"
                    + "(?, ?);");

            pstmt.setString(1, o.getUsuario());
View Full Code Here

    }
   
   
    public boolean autenticar(Usuario o) {

        Connection con = (Connection) ConectaBanco.getConexao();
        PreparedStatement pstmt = null;

        try {
            // Criação de consulta personalizada

            if (o == null) {
                return false;

            } else {
                pstmt = con.prepareStatement("select * from usuario "
                        + "where usuario = ? and senha = ? "
                        );
                pstmt.setString(1, o.getUsuario());
                pstmt.setString(2, o.getSenha());
                pstmt.setTimestamp(3, new Timestamp(new Date().getTime()));
View Full Code Here

    
    
    
      public Usuario buscarPorNome(Usuario o) {

        Connection con = (Connection) ConectaBanco.getConexao();
        PreparedStatement pstmt = null;

        try {
            // Criação de consulta personalizada

            if (o == null) {
                return null;

            } else {

                // Com restrição de limite de quantidade de retorno.
                pstmt = con.prepareStatement("select * from usuario where usuario = ?;");
                pstmt.setString(1, o.getUsuario());
            }

        } catch (SQLException sqlex) {
            //LogExcecao.registraExcecao(sqlex);
View Full Code Here

TOP

Related Classes of com.mysql.jdbc.Connection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.