hi
This commit is contained in:
parent
032d3a9b9c
commit
fb2b191a73
@ -29,7 +29,6 @@ Connection conn;
|
||||
}
|
||||
|
||||
public ResultSet executeQuery(String sql) {
|
||||
|
||||
try {
|
||||
PreparedStatement stmt = conn.prepareStatement(sql);
|
||||
return stmt.executeQuery();
|
||||
|
@ -1,11 +1,6 @@
|
||||
package com.wasteinformationserver;
|
||||
|
||||
import com.wasteinformationserver.mqtt.*;
|
||||
import org.eclipse.paho.client.mqttv3.MqttException;
|
||||
|
||||
import java.net.URISyntaxException;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class main {
|
||||
public static void main(String[] args) {
|
||||
/*
|
||||
@ -32,11 +27,9 @@ public class main {
|
||||
|
||||
mqtt m = new mqtt();
|
||||
// m.notifymessage();
|
||||
try {
|
||||
m.getDatabasedata();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
m.printlist();
|
||||
// Log.message("mqtt irgentwos");
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,11 @@ package com.wasteinformationserver.mqtt;
|
||||
|
||||
import com.wasteinformationserver.db.jdcb;
|
||||
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
@ -29,30 +32,38 @@ public class mqtt {
|
||||
});
|
||||
}
|
||||
|
||||
public void getDatabasedata() throws SQLException {
|
||||
jdcb database=new jdcb("placeuser","eaL956R6yFItQVBl","wasteinformation");
|
||||
ResultSet result = database.executeQuery("SELECT*FROM place");
|
||||
public void getDatabasedata() {
|
||||
int n=0;
|
||||
|
||||
while(result.next())
|
||||
{
|
||||
String temp= String.valueOf(result.getStatement());
|
||||
jdcb Database = new jdcb("placeuser", "eaL956R6yFItQVBl", "wasteinformation");
|
||||
ResultSet result = Database.executeQuery("SELECT*FROM place WHERE Zone=1");
|
||||
try {
|
||||
while (result.next()) {
|
||||
String temp = String.valueOf(result.getString("Abholtag"));
|
||||
System.out.println(temp);
|
||||
filllist(temp);
|
||||
n++;
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
transmitmessagetoESP();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//transmitmessagetoESP();
|
||||
private void transmitmessagetoESP() {
|
||||
mqtttransmitter mt = new mqtttransmitter(mylist);
|
||||
}
|
||||
|
||||
private void transmitmessagetoESP()
|
||||
{
|
||||
|
||||
mqtttransmitter mt=new mqtttransmitter();
|
||||
}
|
||||
|
||||
private void filllist(String temp)
|
||||
{
|
||||
private void filllist(String temp) {
|
||||
mylist.add(index, temp);
|
||||
}
|
||||
|
||||
public void printlist() {
|
||||
for (int n = 0; n < index; n++) {
|
||||
System.out.println(mylist.get(index));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,10 +6,15 @@ import org.eclipse.paho.client.mqttv3.MqttException;
|
||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class mqtttransmitter {
|
||||
|
||||
public mqtttransmitter() {
|
||||
public mqtttransmitter(ArrayList<String> mylist) {
|
||||
|
||||
}
|
||||
|
||||
public void sendmessage(ArrayList mylist) {
|
||||
String topic = "kk";
|
||||
String content = "Message from MqttPublishSample";
|
||||
int qos = 2;
|
||||
@ -41,4 +46,5 @@ public class mqtttransmitter {
|
||||
me.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user