Outils pour utilisateurs

Outils du site


lang:java:jdbc

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
lang:java:jdbc [2019/01/21 07:31] – ↷ Page déplacée de helloworld:sql:java:jdbc à lang:java:jdbc rootlang:java:jdbc [2020/04/26 21:58] (Version actuelle) – Conversion de <note> vers <WRAP> root
Ligne 1: Ligne 1:
-Utilisation de [[https://commons.apache.org/proper/commons-dbcp/download_dbcp.cgi|DBCP2]], {{ :helloworld:sql:java:jdbc:commons-dbcp2-2.1.1-bin.tar.gz |Archive}}, [[http://dev.mysql.com/downloads/connector/j|JDBC]], {{ :helloworld:sql:java:jdbc:mysql-connector-java-5.1.40.tar.gz |Archive}}, [[http://commons.apache.org/proper/commons-pool/download_pool.cgi|Apache Pool]], {{ :helloworld:sql:java:jdbc:commons-pool2-2.4.2-bin.tar.gz |Archive}} et [[http://commons.apache.org/proper/commons-logging/download_logging.cgi|Apache Logging]], {{ :helloworld:sql:java:jdbc:commons-logging-1.2-bin.tar.gz |Archive}} ([[ide:eclipse:projet#installation_d_une_librairie|installation]]).+Utilisation de [[https://commons.apache.org/proper/commons-dbcp/download_dbcp.cgi|DBCP2]], {{ lang:java:jdbc:commons-dbcp2-2.1.1-bin.tar.gz |Archive}}, [[http://dev.mysql.com/downloads/connector/j|JDBC]], {{ lang:java:jdbc:mysql-connector-java-5.1.40.tar.gz |Archive}}, [[http://commons.apache.org/proper/commons-pool/download_pool.cgi|Apache Pool]], {{ lang:java:jdbc:commons-pool2-2.4.2-bin.tar.gz |Archive}} et [[http://commons.apache.org/proper/commons-logging/download_logging.cgi|Apache Logging]], {{ lang:java:jdbc:commons-logging-1.2-bin.tar.gz |Archive}} ([[ide:eclipse:projet#installation_d_une_librairie|installation]]).
 =====Méthode 1 : BasicDataSource et executeQuery===== =====Méthode 1 : BasicDataSource et executeQuery=====
 Cette méthode utilise ''executeQuery'' qui ne protège pas contre les risques d'injection. ''prepareStatement'' de la méthode 2 est préférable si la requête contient des données saisies par l'utilisateur. Cette méthode utilise ''executeQuery'' qui ne protège pas contre les risques d'injection. ''prepareStatement'' de la méthode 2 est préférable si la requête contient des données saisies par l'utilisateur.
Ligne 54: Ligne 54:
 </file> </file>
  
-<note>Les indices dans les fonctions SQL commencent généralement à 1.</note>+<WRAP center round info 60%> 
 +Les indices dans les fonctions SQL commencent généralement à 1. 
 +</WRAP>
  
 =====Méthode 2 : DriverManager et prepareStatement===== =====Méthode 2 : DriverManager et prepareStatement=====
Ligne 61: Ligne 63:
 ''DriverManager'' n'a besoin que de la librairie ''JBDC'' (''Connector/J''). ''DriverManager'' n'a besoin que de la librairie ''JBDC'' (''Connector/J'').
  
-<note important>''DriverManager'' ne doit être utilisé qu'en test et pas en production [[http://stackoverflow.com/questions/15198319/why-do-we-use-a-datasource-instead-of-a-drivermanager|Source]]{{ :helloworld:sql:java:jdbc:java_-_why_do_we_use_a_datasource_instead_of_a_drivermanager_-_stack_overflow.htm.maff |Archive}}.</note>+<WRAP center round important 60%> 
 +''DriverManager'' ne doit être utilisé qu'en test et pas en production [[https://stackoverflow.com/questions/15198319/why-do-we-use-a-datasource-instead-of-a-drivermanager|Why do we use a DataSource instead of a DriverManager?]] {{ :lang:java:jdbc:java_-_why_do_we_use_a_datasource_instead_of_a_drivermanager_-_stack_overflow_2020-04-26_9_56_44_pm_.html |Archive du 04/03/2013 le 26/04/2020}}. 
 +</WRAP>
  
 <file java SQL2.java> <file java SQL2.java>
lang/java/jdbc.1548052308.txt.gz · Dernière modification : 2019/01/21 07:31 de root