Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package com.mycompany.projetourb;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Scanner;
- import java.util.logging.Level;
- import java.util.logging.Logger;
- import org.simmetrics.StringMetric;
- import static org.simmetrics.builders.StringDistanceBuilder.with;
- import static org.simmetrics.builders.StringMetricBuilder.with;
- import org.simmetrics.metrics.SmithWaterman;
- public class Main {
- public static void main(String[] args) throws ClassNotFoundException, SQLException {
- Connection con = null;
- try {
- con = DriverManager.getConnection(
- "jdbc:postgresql://127.0.0.1:5432/projeto", "postgres",
- "ALUNO");
- } catch (SQLException e) {
- System.out.println("Falha na conexão");
- e.printStackTrace();
- }
- if (con != null) {
- System.out.println("Conexão realizada com sucesso!");
- } else {
- System.out.println("Erro ao conectar");
- }
- Scanner sc = new Scanner(System.in);
- System.out.println("Digite o endereço a ser pesquisado: ");
- String pesquisa = sc.nextLine();
- String sql = "select * from ruas where municipio = 'Lages' and uf = 'SC'";
- PreparedStatement ps = con.prepareStatement(sql);
- ResultSet rs = ps.executeQuery();
- List<Ruas> listaRuas = new ArrayList<>();
- while (rs.next()) {
- Ruas ruas = new Ruas();
- ruas.setNomeRua(rs.getString("nome"));
- listaRuas.add(ruas);
- }
- StringMetric comparador = with(new SmithWaterman()).build();
- for(Ruas ruas : listaRuas) {
- }
- //Comparar todos os nomes no for each com a pesquisa, e a string que tiver o valor maior, jogar numa proxima pesquisa SQL para o geom
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement