Skip to content

Commit af527c3

Browse files
committed
versao 2.0
1 parent fe8e189 commit af527c3

File tree

5 files changed

+20
-24
lines changed

5 files changed

+20
-24
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/NativeServer2/NativeServer2/dist/
22
/NativeServer2/NativeServer/build/
3-
/NativeServer2/NativeServer/nbproject/private/
3+
/NativeServer2/NativeServer/nbproject/private/
4+
/NativeServer2/NativeServer/dist/

NativeServer2/NativeServer/src/java/Db/ArvoreDb.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@ public ArrayList<Arvore> consultarTodas() {
6666
String sql = "select * from arvore ORDER BY idarvore";
6767
System.out.println("sql "+sql);
6868
try {
69-
70-
ResultSet resultado = ConexaoBD.getInstance().getConnection().createStatement().executeQuery(sql);
71-
69+
System.out.println("start");
70+
ConexaoBD bd = new ConexaoBD();
71+
ResultSet resultado = bd.getInstance().getConnection().createStatement().executeQuery(sql);
72+
System.out.println("stop");
7273
while (resultado.next()) {
7374
Arvore v = new Arvore();
7475
v.setEnderecoGeoCode(resultado.getString("geocode"));
@@ -90,7 +91,7 @@ public ArrayList<Arvore> consultarTodas() {
9091
}
9192

9293
} catch (Exception e) {
93-
System.out.println("Erro 0002 ao consultar arvores = " + e);
94+
System.out.println("Erro 0002aasd ao consultar arvores = " + e);
9495
System.out.println("Erro 0002 ao consultar arvores error = " + e.toString());
9596
return null;
9697
}
@@ -124,7 +125,7 @@ public Arvore consultarArvore(Arvore arvore) {
124125
}
125126

126127
} catch (Exception e) {
127-
System.out.println("Erro 0002 ao consultar arvores = " + e);
128+
System.out.println("Erro 000222 ao consultar arvores = " + e);
128129
return null;
129130
}
130131
return null;

NativeServer2/NativeServer/src/java/Model/ConexaoBD.java

+11-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ public class ConexaoBD {
1919
private Connection conexao = null;
2020

2121
public ConexaoBD() {
22+
System.out.println("inicio construtor");
2223
try {
24+
2325
// Carrega informações do arquivo de propriedades
2426
Properties prop = new Properties();
2527
//prop.load(new FileInputStream("DB.propertie s"));
@@ -31,8 +33,9 @@ public ConexaoBD() {
3133

3234

3335
// Carrega Driver do Banco de Dados
36+
System.out.println("carregando driver bd");
3437
Class.forName(dbdriver);
35-
38+
System.out.println("carregado");
3639
if (dbuser.length() != 0) // conexão COM usuário e senha
3740
{
3841
conexao = DriverManager.getConnection(dburl, dbuser, dbsenha);
@@ -42,23 +45,30 @@ public ConexaoBD() {
4245
}
4346

4447
} catch (Exception e) {
48+
System.out.println("erro ao criar conex "+e);
4549
System.err.println(e);
4650
}
4751
}
4852

4953
// Retorna instância
5054
public static ConexaoBD getInstance() {
55+
System.out.println("instanciando");
5156
if (instancia == null) {
57+
System.out.println("constructor");
5258
instancia = new ConexaoBD();
59+
System.out.println("done");
5360
}
5461
return instancia;
5562
}
5663

5764
// Retorna conexão
5865
public Connection getConnection() {
66+
System.out.println("get conection");
5967
if (conexao == null) {
68+
System.out.println("errror cx nul");
6069
throw new RuntimeException("conexao==null");
6170
}
71+
System.out.println("return");
6272
return conexao;
6373
}
6474

NativeServer2/NativeServer/web/index.html

-16
This file was deleted.

NativeServer2/NativeServer/web/server.jsp

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<title>Native Server</title>
1313
</head>
1414
<body>
15-
<h1>Exemplos de como usar o servidor NativeServer!</h1>
15+
<h1>Exemplos de como usar o servidor NativeServer! versao 2.0</h1>
1616
<span><a href="/NativeServer/actions?acao=cadarvore&id=0&idespecie=1&idade=25&lat=33.333&longt=44.444&idpropietario=1&idusuario=1&status=viva&geocode=Rua%20ABC,%20Lajeado">Clique aqui para inserir uma arvore de exemplo</a></span>
1717
<br>
1818
<span><a href="/NativeServer/actions?acao=cadarvore&id=2&idespecie=1&idade=30&lat=13133.333&longt=1244.444&idpropietario=1&idusuario=1&status=morta&geocode=Rua%20ABC,%20LajeadoAlterado">Clique aqui para alterar a arvore id 2</a></span>

0 commit comments

Comments
 (0)