Bonjour,
j'aimerai savoir pourquoi quand je lance la connexion à la BDD dans un programme java sa marche bien par contre avec JSP,il ne reconnais pas les instructions ?
quand j'exécute ,aucune erreur mais beaucoup d'exceptions !!!!
voici mon code :
il ne reconnais pas l'instruction :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
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 <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> Titre </title> <link href="templatemo_style.css" rel="stylesheet" type="text/css" /> </head> <body> <%@ page import="java.sql.Connection" %> <%@ page import="java.sql.DriverManager" %> <%@ page import="java.sql.ResultSet" %> <%@ page import="java.sql.Statement" %> <%@ page import="java.sql.*" %> <% Class.forName("org.hsqldb.jdbcDriver").newInstance(); Connection connexion = DriverManager.getConnection("jdbc:hsqldb:file:Essaye", "sa", ""); Statement st = connexion.createStatement(); ResultSet resultat = st.executeQuery("SELECT * FROM Connexion WHERE prenom='azerty'"); if(resultat.next()) System.out.println(resultat.getString("Nom")); st.executeQuery("SHUTDOWN"); st.close(); connexion.close(); %> </body> </html>
que dois je faire ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part Class.forName("org.hsqldb.jdbcDriver").newInstance();
Partager