Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.*;
- import javax.swing.JOptionPane;
- public class JDBC {
- static final String driver = "com.jdbc.mysql.Driver";
- static final String url = "jdbc:mysql://192.168.105.254/JAVATEST?user=max&password=test";
- try{
- Class.forName(driver);
- }catch(java.lang.ClassNotFoundException e){
- System.out.println("error");
- }
- try{
- Connection con=DriverManager.getConnection(url);
- String reply=JOptionPane.showInputDialog("Inserisci un intero x");
- PreparedStatement pquery= con.prepareStatement("Select Nome,Cognome from Socio where Matricola in(Select Socio,Count(Volume) from Prestito group by Socio having Count(Volume)>=?");
- pquery.setString(1,reply);
- ResultSet result = pquery.executeQuery();
- }catch(SQLException ex){
- System.out.println("sql sintax error");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement