Précédent   Forum du club des développeurs et IT Pro > Java > Général Java > JDBC
JDBC Forum d'entraide sur l'API JDBC (Java Database Connectivity) et l'accès aux bases de données. Avant de poster -> FAQ JDBC
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse
 
Outils de la discussion
Publicité
'
Vieux 13/12/2012, 20h03   #1
crippy
Invité de passage
 
Femme crippy crippy
Étudiant
Inscription : juillet 2012
Messages : 7
Détails du profil
Informations personnelles :
Nom : Femme crippy crippy
Localisation : Maroc

Informations professionnelles :
Activité : Étudiant
Secteur : Enseignement

Informations forums :
Inscription : juillet 2012
Messages : 7
Points : 2
Points : 2
Par défaut Commande SQL qui ne fonctionne pas dans une JSP

Bonjour,

J'aimerais pouvoir afficher sur une page, toutes les informations d'un tablespace (taille utilisée, taille libre, type d'allocation...) et pour cela j'exécute la commande suivante, qui se trouve dans une JSP
Code :
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
<%
    Connection c = ODBConnect.cnx();
    Statement st = c.createStatement();
    ResultSet rs = st.executeQuery("select  a.TABLESPACE_NAME, a.CONTENTS, a.EXTENT_MANAGEMENT, a.ALLOCATION_TYPE,  a.SEGMENT_SPACE_MANAGEMENT, a.BIGFILE,  a.STATUS, nvl(sum(b.count_files),0) FILES, nvl(sum(b.bytes),0), nvl(sum(b.maxbytes),0) MAX_SIZE, nvl(sum(b.bytes),0)-nvl(sum(c.free_bytes),0) from DBA_TABLESPACES a,(select TABLESPACE_NAME, sum(BYTES) bytes, count(*) count_files, sum(greatest(MAXBYTES,BYTES)) maxbytes from DBA_DATA_FILES group by TABLESPACE_NAME union all select TABLESPACE_NAME, sum(BYTES),  count(*), sum(greatest(MAXBYTES,BYTES)) maxbytes from DBA_TEMP_FILES group by TABLESPACE_NAME) b, (select TABLESPACE_NAME, sum(BYTES) free_bytes from DBA_FREE_SPACE group by TABLESPACE_NAME union all select TABLESPACE_NAME, sum(BYTES_FREE) free_bytes from V$TEMP_SPACE_HEADER group by TABLESPACE_NAME) c where a.TABLESPACE_NAME = b.TABLESPACE_NAME  and a.TABLESPACE_NAME = c.TABLESPACE_NAME group by a.TABLESPACE_NAME, a.CONTENTS, a.EXTENT_MANAGEMENT, a.ALLOCATION_TYPE,  a.SEGMENT_SPACE_MANAGEMENT, a.BIGFILE,a.STATUS order by a.TABLESPACE_NAME;");
    //while(rs.next());
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title></title>
</head>
<body>
 
    <table border>
        <tr><th>TABLESPACE</th><th>CONTENTS</th><th>EXTENT_MAN</th><th>ALLOCATION</th><th>SEGMENT</th><th>BIG</th><th>STATUS</th><th>FILES</th><th>SIZE</th><th>MAX_SIZE</th><th>USED</th></tr>
        <%
            while(rs.next()){
                out.print("<tr><td>"+rs.getString(1)+"</td><td>"+rs.getString(2)+"</td><td>"+rs.getString(3)+"</td><td>"+rs.getString(4)+"</td><td>"+rs.getString(5)+"</td><td>"+rs.getString(6)+"</td><td>"+rs.getString(7)+"</td><td>"+rs.getString(8)+"</td><td>"+rs.getString(9)+"</td><td>"+rs.getString(10)+"</td><td>"+rs.getString(11)+"</td></tr>");
            }
        %>
    </table>
 
</body>
</html>
Le problème est que dans mon application ça m'affiche une erreur (mot clé manqué) par contre, lorsque je l’exécute sous SQL Plus ça fonctionne très bien.

Quelqu'un saurait-il m'indiquer d'où peut venir le problème ?

Merci d'avance pour votre aide.
crippy est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 14/12/2012, 09h50   #2
chtig
Membre Expert
 
Inscription : janvier 2007
Messages : 1 331
Détails du profil
Informations personnelles :
Âge : 36
Localisation : France, Paris (Île de France)

Informations forums :
Inscription : janvier 2007
Messages : 1 331
Points : 1 561
Points : 1 561
Tu pourrais nous faire un copier coller de l'erreur ?
__________________
Program manager chez TraceOne. http://www.traceone.com
chtig est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse
Outils de la discussion

Navigation rapide


Fuseau horaire GMT +2. Il est actuellement 00h51.


 
 
 
 
Partenaires

Hébergement Web