| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 
 |  
 
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.SQLException;
import java.sql.*;
 
import java.util.Date; 
 
public class connection 
{
    private Connection Connect;
    private Statement Stat;
 
 
    public connection () 
    {
        this.doconnect();
    }
 
 
    public Connection getConnect () {
        return Connect;
    }
 
    public void setConnect (Connection val) {
        this.Connect = val;
    }
 
 
    public Statement getStat () {
        return Stat;
    }
 
    public void setStat (Statement val) {
        this.Stat = val;
    }
 
    public void doconnect()
    {
        try
        {
            String dbUrl = "jdbc:derby://localhost:1527/myeclipse";
// Charger le driver (qui s'enregistrera lui-même)
            try
            {
                Class.forName("org.apache.derby.jdbc.ClientDriver");
                this.setConnect(DriverManager.getConnection(dbUrl));
                this.setStat(Connect.createStatement());
 
            }
            catch (ClassNotFoundException ex) 
            {
            }
        }
        catch (SQLException e)
        {}
    }
    static void main() 
    {
        connection con=new connection();
        String requete="select ID from \"APP\".\"client\" where ID =12";
        con.getStat().executeQuery(requete);        
 
 
 
    }
} |