Dbm (discuter | contributions) m |
Dbm (discuter | contributions) |
||
(12 révisions intermédiaires par un utilisateur sont masquées) | |||
Ligne 1 : | Ligne 1 : | ||
− | |||
− | |||
− | |||
<center><big><big>'''Contact'''</big></big></center> | <center><big><big>'''Contact'''</big></big></center> | ||
− | + | '''Address/Adresse''' | |
+ | :PReCISE / LIBD | ||
+ | :Faculté d'informatique | ||
+ | :Rue Grandgagnage, 21 | ||
+ | :B-5000 Namur - Belgium | ||
− | + | '''Accès/Access''': [http://http://www.unamur.be/universite/acces Français] [http://www.unamur.be/en/access English] | |
− | |||
− | * | + | * Jean-Luc Hainaut (e-mail: jean-luc.hainaut AT unamur.be) |
− | * | + | * Vincent Englebert (e-mail: vincent.englebert AT unamur.be) |
− | * | + | * Anthony Cleve (''e-mail'': anthony.cleve AT unamur.be) |
− | |||
− | |||
− | |||
− | + | <!-- | |
− | + | '''''Please ignore the following section''''' | |
− | * | + | '''Comparing SQLfast and Java/JDBC'''<br> |
+ | The SQLfast code (here just a simple SQL query) is executed at level 0 (Learning SQL), when database ORDERS.db has been opened. Error exceptions are coped with automatically. | ||
+ | {| | ||
+ | |<div style="width: 260px;height:300px;padding-left:5px;padding-top:1px;background-color:#E5E5E5;"> | ||
+ | <code><font color="blue">'''select''' NCLI,NOM '''from CLIENT''';</font></code><br> | ||
+ | </div> | ||
+ | |<div style="width:420px;height:300px;padding-left:5px;padding-top:1px;background-color:#E5E5E5;overflow:auto;"> | ||
+ | <code>import java.net.URL;</code><br> | ||
+ | <code>import java.io.*;</code><br> | ||
+ | <code>import ...;</code><br> | ||
+ | <code>import java.sql.*;</code><br> | ||
+ | <code>import java.util.*;</code><br> | ||
+ | <code>String url = "jdbc:interbase://server1/CLICOM.gdb";</code><br> | ||
+ | <code>String user ="myLogin";</code><br> | ||
+ | <code>String pw="myPassword";</code><br> | ||
+ | <code>Connexion conn = null;</code><br> | ||
+ | <code>Statement stmt = null;</code><br> | ||
+ | <code>ResultSet res = null;</code><br> | ||
+ | <code>String selectQ = <font color="blue">"'''select''' NCLI,NOM '''from''' CLIENT"</font>;</code><br> | ||
+ | <code>String CiD;</code><br> | ||
+ | <code>String Cnom;</code><br> | ||
− | + | <code>try {</code><br> | |
+ | <code> Class.forName("interbase.interclient.Driver");</code><br> | ||
+ | <code> conn = DriverManager.getConnection(url,user,pw);</code><br> | ||
+ | <code> }</code><br> | ||
+ | <code>catch (Exception e) {</code><br> | ||
+ | <code> System.err.println( e.getClass().getName()</code><br> | ||
+ | <code> + ": " + e.getMessage() );</code><br> | ||
+ | <code> System.exit(0);</code><br> | ||
+ | <code> }</code><br> | ||
+ | <code>try {</code><br> | ||
+ | <code> stmt = conn.createStatement ();</code><br> | ||
+ | <code> res = stmt.executeQuery (selectQ);</code><br> | ||
+ | <code> System.out.println("NCLI, NOM");</code><br> | ||
+ | <code> while (res.next()) {</code><br> | ||
+ | <code> CiD = res.getString("NCLI");</code><br> | ||
+ | <code> Cnom = res.getString("NOM");</code><br> | ||
+ | <code> System.out.println(CiD + ", " + Cnom);</code><br> | ||
+ | <code> }</code><br> | ||
+ | <code> res.close();</code><br> | ||
+ | <code> stmt.close();</code><br> | ||
+ | <code> conn.close();</code><br> | ||
+ | <code> }</code><br> | ||
+ | <code>catch (Exception e) {</code><br> | ||
+ | <code> System.err.println( e.getClass().getName()</code><br> | ||
+ | <code> + ": " + e.getMessage() );</code><br> | ||
+ | <code> }</code><br> | ||
+ | </div> | ||
+ | |} | ||
+ | --> | ||
[[Accueil|<''Retour à la page d'accueil / Back''>]] | [[Accueil|<''Retour à la page d'accueil / Back''>]] |
Address/Adresse
Accès/Access: Français English