import java.sql.*; import java.util.ArrayList; import javax.swing.*;
public class punkty {
String serverName = ?; String database = ?; String user = ?; String password = ?; String JDBC= "com.mysql.jdbc.Driver"; String url = ?; public static void main(String[] args) throws SQLException, ClassNotFoundException {
Connection connection = DriverManager.getConnection(url, user, password); Statement s = null; Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); s = connection.createStatement();
String sql = "SELECT a, b ,c ,d FROM db"; ResultSet rs = s.executeQuery(sql); float a1,a2,b1,b2; float x,y; while(rs.next()){ a1 = rs.getFloat("a"); a2 = rs.getFloat("b"); x=a1+a2; // result: group of x points b1 = rs.getFloat("c"); b2 = rs.getFloat("d"); y=b1+b2; // result: group of y points
// What was the problem: // This code is working well but I dont know how to get values from while loop to make below steps
// Pn(xn,yn) - there is that many points as many probes // number of probes is changing very fast // I want to create array with x and y values // Using array create points which I will represent in existing interface created in another class (on button click) } } }