<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Shakaran &#187; Java</title>
	<atom:link href="http://shakaran.es/blog/category/Java/feed/" rel="self" type="application/rss+xml" />
	<link>http://shakaran.es/blog</link>
	<description>Blog de un estudiante de ingeniería informática</description>
	<lastBuildDate>Fri, 12 Feb 2010 15:13:12 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<image>
  <link>http://shakaran.es/blog</link>
  <url>http://www.shakaran.es/blog/wp-content/favicon.png</url>
  <title>Shakaran</title>
</image>
		<item>
		<title>JDBC y HSQLDB: crear bases de datos con Java y el motor de base de datos de OpenOffice</title>
		<link>http://shakaran.es/blog/2009/10/jdbc-y-hsqldb-crear-bases-de-datos-con-java-y-el-motor-de-base-de-datos-de-openoffice/</link>
		<comments>http://shakaran.es/blog/2009/10/jdbc-y-hsqldb-crear-bases-de-datos-con-java-y-el-motor-de-base-de-datos-de-openoffice/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 11:25:22 +0000</pubDate>
		<dc:creator>shakaran</dc:creator>
				<category><![CDATA[Ingeniería del software]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Universidad]]></category>
		<category><![CDATA[alumnos]]></category>
		<category><![CDATA[asignaturas]]></category>
		<category><![CDATA[base]]></category>
		<category><![CDATA[base de datos]]></category>
		<category><![CDATA[conector]]></category>
		<category><![CDATA[consultas]]></category>
		<category><![CDATA[datos]]></category>
		<category><![CDATA[driver]]></category>
		<category><![CDATA[ejemplo]]></category>
		<category><![CDATA[hsql]]></category>
		<category><![CDATA[hsqldb]]></category>
		<category><![CDATA[insert]]></category>
		<category><![CDATA[jdbc]]></category>
		<category><![CDATA[openoffice]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://shakaran.es/blog/?p=649</guid>
		<description><![CDATA[




HSQLDB es un sistema de bases de datos relacional SQL escrito en Java, de unos 600 kb usado por aplicaciones como OpenOffice. Dispone de un controlador JDBC y ofrece un pequeño y rápido sistema de bases de datos que gestiona tablas basadas en disco y memoria con un modo servidor y embebido, además de incluir [...]<br /><div><img src="http://shakaran.es/blog/wp-content/plugins/gd-star-rating/gfx.php?value=9.0" /></div><div>Rating: 9.0/<strong>10</strong> (2 votes cast)</div><br />


Entradas relacionadas:<ol><li><a href='http://shakaran.es/blog/2009/08/crear-paquetes-deb-de-codigo-python-en-ubuntu/' rel='bookmark' title='Permanent Link: Crear paquetes DEB de código Python en Ubuntu'>Crear paquetes DEB de código Python en Ubuntu</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="mceTemp mceIEcenter">
<dl id="attachment_672" class="wp-caption aligncenter" style="width: 310px;margin:auto">
<dt class="wp-caption-dt"><a href="http://shakaran.es/blog/wp-content/uploads/2009/10/java-jdbc-hsqldb-openoffice.png"><img class="size-full wp-image-672" title="java-jdbc-hsqldb-openoffice" src="http://shakaran.es/blog/wp-content/uploads/2009/10/java-jdbc-hsqldb-openoffice.png" alt="java-jdbc-hsqldb-openoffice" width="300" height="259" /></a></dt>
</dl>
</div>
<p style="text-align: justify;"><a title="Wikipedia: HSQLDB" href="http://es.wikipedia.org/wiki/HSQLDB" target="_blank">HSQLDB</a> es un sistema de bases de datos relacional SQL escrito en Java, de <strong>unos 600 kb </strong>usado por aplicaciones como OpenOffice. Dispone de un controlador <a title="Wikipedia: JDBC" href="http://es.wikipedia.org/wiki/Java_Database_Connectivity" target="_blank">JDBC</a> y ofrece un <strong>pequeño y rápido</strong> sistema de bases de datos que gestiona tablas basadas en <strong>disco y memoria</strong> con un modo servidor y embebido, además de incluir un pequeño servidor web,  herramientas de manejo y de consulta basadas en memoria que pueden correr en forma de aplicaciones.</p>
<p style="text-align: justify;">En Ubuntu para usuarlo es necesario instalar el <strong>servidor hsqldb</strong>:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Descargar <a href="http://shakaran.es/blog/wp-content/plugins/wp-codebox/wp-codebox.php?p=649&amp;download=instalar-hsqldb.txt">instalar-hsqldb.txt</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p6495"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p649code5"><pre class="shell" style="font-family:monospace;">sudo apt-get install hsqldb-server</pre></td></tr></table></div>

<p style="text-align: justify;">A continuación expondré un <strong>pequeño ejemplo</strong> no muy sofisticado para mostrar un posible uso básico. Presupongo un cierto conocimiento en Java y de bases de datos, asi como del lenguaje SQL.</p>
<p style="text-align: justify;">Explicare unas breves líneas de cada parte del código sin profundizar demasiado, ya que el código esta <strong>bastante estructurado </strong>y es casi auto-explicativo para alguien que tenga ciertos conocimientos en la materia. </p>
<p>También ciertas partes del código o mensajes están en inglés, esto es así, porque generalmente estoy acostumbrado a hacerlo de tal modo (y para mí es una <strong>buena práctica</strong> de uso hacerlo), de todas formas no es un inglés demasiado complicado.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Descargar <a href="http://shakaran.es/blog/wp-content/plugins/wp-codebox/wp-codebox.php?p=649&amp;download=BDprac.java">BDprac.java</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p6496"><td class="line_numbers"><pre>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
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
</pre></td><td class="code" id="p649code6"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.sql.Connection</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.sql.DriverManager</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.sql.ResultSet</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.sql.Statement</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Properties</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> BDprac
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">static</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aconnection+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Connection</span></a> con  <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">static</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astatement+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Statement</span></a>  st   <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>  
    <span style="color: #000000; font-weight: bold;">static</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aresultset+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">ResultSet</span></a>  res  <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span> 
    <span style="color: #000000; font-weight: bold;">static</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a>     sql  <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> DBH <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;jdbc:hsqldb:file:src/bd&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">// With memory: &quot;jdbc:hsqldb:mem:bdname&quot;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> args<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aioexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">IOException</span></a>
    <span style="color: #009900;">&#123;</span>
        loadHSQLDB<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        connectDB<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        createStatement<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        dropTables<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        createTables<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        restoreDB<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        menu<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        closeHSQLDB<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> loadHSQLDB<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;* Starting...&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">try</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">Class</span>.<span style="color: #006633;">forName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;org.hsqldb.jdbcDriver&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Load HSQLDB driver</span>
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;* Loading HSQLDB driver...&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> 
        <span style="color: #000000; font-weight: bold;">catch</span><span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a> e<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>  
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">err</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;ERROR: failed to load HSQLDB JDBC driver.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">return</span><span style="color: #339933;">;</span>  
        <span style="color: #009900;">&#125;</span> 
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> connectDB<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">try</span>
        <span style="color: #009900;">&#123;</span>   <span style="color: #666666; font-style: italic;">// Connect to the database or create if it don't exist </span>
            con <span style="color: #339933;">=</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Adrivermanager+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">DriverManager</span></a>.<span style="color: #006633;">getConnection</span><span style="color: #009900;">&#40;</span>DBH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;* Creating HSQLDB connection...&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">catch</span><span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a> e<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">err</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Error: &quot;</span> <span style="color: #339933;">+</span> e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">return</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> createStatement<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">try</span>
        <span style="color: #009900;">&#123;</span>
            st  <span style="color: #339933;">=</span> con.<span style="color: #006633;">createStatement</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a> e<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>  
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">err</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Error: createStatement: &quot;</span> <span style="color: #339933;">+</span> e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   
            <span style="color: #000000; font-weight: bold;">return</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> dropTables<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">try</span> 
        <span style="color: #009900;">&#123;</span>   <span style="color: #666666; font-style: italic;">// Drop tables</span>
            st.<span style="color: #006633;">executeUpdate</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;DROP TABLE IF EXISTS stusub;DROP TABLE IF EXISTS student;DROP TABLE IF EXISTS subject;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;* Drop table if exists...&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a> e<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>  
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">err</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Warning: drop table: &quot;</span> <span style="color: #339933;">+</span> e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   
        <span style="color: #009900;">&#125;</span>  
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> createTables<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">try</span> 
        <span style="color: #009900;">&#123;</span>   <span style="color: #666666; font-style: italic;">// Create tables</span>
            sql <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;CREATE TABLE student ( &quot;</span> <span style="color: #339933;">+</span>
                                            <span style="color: #0000ff;">&quot;id         INTEGER NOT NULL PRIMARY KEY, &quot;</span> <span style="color: #339933;">+</span>
                                            <span style="color: #0000ff;">&quot;name       VARCHAR(25) NOT NULL, &quot;</span> <span style="color: #339933;">+</span>
                                            <span style="color: #0000ff;">&quot;lastname   VARCHAR(100), &quot;</span> <span style="color: #339933;">+</span>
                                            <span style="color: #0000ff;">&quot;address    VARCHAR(100), &quot;</span> <span style="color: #339933;">+</span>
                                            <span style="color: #0000ff;">&quot;city       VARCHAR(100), &quot;</span> <span style="color: #339933;">+</span>
                                            <span style="color: #0000ff;">&quot;pcode      VARCHAR(5), &quot;</span> <span style="color: #339933;">+</span>
                                            <span style="color: #0000ff;">&quot;email      VARCHAR(80), &quot;</span> <span style="color: #339933;">+</span>
                                            <span style="color: #0000ff;">&quot;mobile     VARCHAR(50), &quot;</span> <span style="color: #339933;">+</span>
                                            <span style="color: #0000ff;">&quot;subject VARCHAR(40),&quot;</span> <span style="color: #339933;">+</span>
                                            <span style="color: #0000ff;">&quot;CONSTRAINT UNIQUE_STU UNIQUE(name)&quot;</span> <span style="color: #339933;">+</span>
                                         <span style="color: #0000ff;">&quot;);&quot;</span><span style="color: #339933;">;</span>  
            st.<span style="color: #006633;">executeUpdate</span><span style="color: #009900;">&#40;</span>sql<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;* Creating student table...&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            sql <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;CREATE TABLE subject ( &quot;</span> <span style="color: #339933;">+</span>
                                            <span style="color: #0000ff;">&quot;id         INTEGER NOT NULL PRIMARY KEY, &quot;</span> <span style="color: #339933;">+</span>
                                            <span style="color: #0000ff;">&quot;name       VARCHAR(100) NOT NULL, &quot;</span> <span style="color: #339933;">+</span>
                                            <span style="color: #0000ff;">&quot;CONSTRAINT UNIQUE_SUB UNIQUE(name)&quot;</span> <span style="color: #339933;">+</span>
                                         <span style="color: #0000ff;">&quot;);&quot;</span><span style="color: #339933;">;</span>  
            st.<span style="color: #006633;">executeUpdate</span><span style="color: #009900;">&#40;</span>sql<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;* Creating subject table...&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            sql <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;CREATE TABLE stusub ( &quot;</span> <span style="color: #339933;">+</span>
                                            <span style="color: #0000ff;">&quot;id             INTEGER NOT NULL PRIMARY KEY, &quot;</span> <span style="color: #339933;">+</span>
                                            <span style="color: #0000ff;">&quot;subject        INTEGER NOT NULL, &quot;</span> <span style="color: #339933;">+</span>
                                            <span style="color: #0000ff;">&quot;student       INTEGER NOT NULL, &quot;</span> <span style="color: #339933;">+</span>
                                            <span style="color: #0000ff;">&quot;FOREIGN KEY (student) REFERENCES student(id), &quot;</span> <span style="color: #339933;">+</span>
                                            <span style="color: #0000ff;">&quot;FOREIGN KEY (subject) REFERENCES subject(id), &quot;</span> <span style="color: #339933;">+</span>
                                            <span style="color: #0000ff;">&quot;CONSTRAINT UNIQUE_STUSUB UNIQUE(subject, student)&quot;</span> <span style="color: #339933;">+</span>
                                         <span style="color: #0000ff;">&quot;);&quot;</span><span style="color: #339933;">;</span>  
            st.<span style="color: #006633;">executeUpdate</span><span style="color: #009900;">&#40;</span>sql<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;* Creating student-subject table...&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> 
        <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a> e<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>  
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">err</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Warning: CREATE TABLE: &quot;</span> <span style="color: #339933;">+</span> e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> restoreDB<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">try</span> 
        <span style="color: #009900;">&#123;</span>   <span style="color: #666666; font-style: italic;">// Restore the database  </span>
            st.<span style="color: #006633;">executeUpdate</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;DELETE FROM stusub;DELETE FROM student;DELETE FROM subject;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;* Restore the original databases, removing all previous inserting data.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a> e<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>  
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">err</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Warning: error on vacuum tables: &quot;</span> <span style="color: #339933;">+</span> e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   
        <span style="color: #009900;">&#125;</span> 
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> menu<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">boolean</span> exit <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">boolean</span> insert <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">int</span> option<span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">while</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>exit<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>.: Menu :.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #339933;">+</span>
                               <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>0 - Salir<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #339933;">+</span>
                               <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>1 - Insertar alumnos y asignaturas por defecto.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #339933;">+</span>
                               <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>2 - Modificar el nombre de una asignatura (0 - Literatura).<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #339933;">+</span>
                               <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>3 - Consultar alumnos por apellido.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #339933;">+</span>
                               <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>4 - Listar todos los alumnos.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #339933;">+</span>
                               <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>5 - Listar todas las asignaturas.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
                               <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
&nbsp;
            <span style="color: #000000; font-weight: bold;">try</span>
            <span style="color: #009900;">&#123;</span>        
                <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">print</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Introduzca una opción numérica:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                option <span style="color: #339933;">=</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Ainteger+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Integer</span></a>.<span style="color: #006633;">parseInt</span><span style="color: #009900;">&#40;</span>read<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>                   
            <span style="color: #009900;">&#125;</span>
            <span style="color: #000000; font-weight: bold;">catch</span><span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Anumberformatexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">NumberFormatException</span></a> ex<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;La opción no es un número.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                option <span style="color: #339933;">=</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
&nbsp;
            <span style="color: #000000; font-weight: bold;">switch</span><span style="color: #009900;">&#40;</span>option<span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#123;</span>
                <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">:</span>
                    exit <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
                <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
                <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">:</span>
                    <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>insert<span style="color: #009900;">&#41;</span>
                    <span style="color: #009900;">&#123;</span>
                        insertData<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        insert <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
                        <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Datos correctamente insertados.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span>
                    <span style="color: #000000; font-weight: bold;">else</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Datos ya insertados previamente.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
                <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">:</span>
                    <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>insert<span style="color: #009900;">&#41;</span>
                    <span style="color: #009900;">&#123;</span>
                        <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Deben insertarse datos previamente.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span>
                    <span style="color: #000000; font-weight: bold;">else</span>
                    <span style="color: #009900;">&#123;</span>
                        <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">print</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Introduzca el nuevo nombre para la asignatura 'Literatura':&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        updateSubject<span style="color: #009900;">&#40;</span>read<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
                <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">:</span>
                    <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>insert<span style="color: #009900;">&#41;</span>
                    <span style="color: #009900;">&#123;</span>
                        <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Deben insertarse datos previamente.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span>
                    <span style="color: #000000; font-weight: bold;">else</span>
                    <span style="color: #009900;">&#123;</span>
                        <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">print</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Introduzca el apellido a consultar:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        showSubjectByLastName<span style="color: #009900;">&#40;</span>read<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
                <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #cc66cc;">4</span><span style="color: #339933;">:</span>
                    <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>insert<span style="color: #009900;">&#41;</span>
                    <span style="color: #009900;">&#123;</span>
                        <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Deben insertarse datos previamente.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span>
                    <span style="color: #000000; font-weight: bold;">else</span>
                    <span style="color: #009900;">&#123;</span>
                        showStudents<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
                <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">:</span>
                    <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>insert<span style="color: #009900;">&#41;</span>
                    <span style="color: #009900;">&#123;</span>
                        <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Deben insertarse datos previamente.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span>
                    <span style="color: #000000; font-weight: bold;">else</span>
                    <span style="color: #009900;">&#123;</span>
                        showSubjects<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
                <span style="color: #000000; font-weight: bold;">default</span><span style="color: #339933;">:</span>
                    <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Opcion incorrecta.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> closeHSQLDB<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// Save temporal data and close</span>
        <span style="color: #000000; font-weight: bold;">try</span>
        <span style="color: #009900;">&#123;</span>
            st <span style="color: #339933;">=</span> con.<span style="color: #006633;">createStatement</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
            st.<span style="color: #006633;">executeUpdate</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SHUTDOWN&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
            st.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">catch</span><span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a> e<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Error: save temporal data&quot;</span> <span style="color: #339933;">+</span> e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">try</span>
        <span style="color: #009900;">&#123;</span>
            con.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">catch</span><span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a> e<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Error: &quot;</span> <span style="color: #339933;">+</span> e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">return</span><span style="color: #339933;">;</span> 
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> read<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">try</span>
        <span style="color: #009900;">&#123;</span>
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Abufferedreader+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">BufferedReader</span></a> br <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Abufferedreader+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">BufferedReader</span></a><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Ainputstreamreader+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">InputStreamReader</span></a><span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">in</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">return</span> br.<span style="color: #006633;">readLine</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">catch</span><span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a> e<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span> 
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Error en la lectura de datos:<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> insertData<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// Insert data  </span>
        <span style="color: #000000; font-weight: bold;">try</span> 
        <span style="color: #009900;">&#123;</span> 
            <span style="color: #666666; font-style: italic;">//Insert subject</span>
            st.<span style="color: #006633;">executeUpdate</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;INSERT INTO subject VALUES ('0', 'Literatura')&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
            st.<span style="color: #006633;">executeUpdate</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;INSERT INTO subject VALUES ('1', 'Ciencia')&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
            st.<span style="color: #006633;">executeUpdate</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;INSERT INTO subject VALUES ('2', 'Redes')&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
&nbsp;
            <span style="color: #666666; font-style: italic;">//Insert student</span>
            st.<span style="color: #006633;">executeUpdate</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;INSERT INTO student VALUES ('0', 'Juan', 'Garrido', 'Sol, 12', 'Sevilla', '13206', 'j.garrido@gmail.com', '609555321', '0')&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
            st.<span style="color: #006633;">executeUpdate</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;INSERT INTO student VALUES ('1', 'Luis', 'Garrido', 'Flor, 5', 'Melilla', '43712', 'l.garrido@gmail.com', '615827343', '0')&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
            st.<span style="color: #006633;">executeUpdate</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;INSERT INTO student VALUES ('2', 'Teresa', 'Garcia', 'Mata, 18', 'Madrid', '28045', 'tere.garcia@gmail.com', '678123687', '1')&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
&nbsp;
            <span style="color: #666666; font-style: italic;">//Foreign keys stusub</span>
            st.<span style="color: #006633;">executeUpdate</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;INSERT INTO stusub VALUES ('0', '0', '0')&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
            st.<span style="color: #006633;">executeUpdate</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;INSERT INTO stusub VALUES ('1', '0', '1')&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
            st.<span style="color: #006633;">executeUpdate</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;INSERT INTO stusub VALUES ('2', '1', '2')&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a> e<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>  
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">err</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Warning: error on insert data: &quot;</span> <span style="color: #339933;">+</span> e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   
            e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">return</span><span style="color: #339933;">;</span> 
        <span style="color: #009900;">&#125;</span> 
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> showStudents<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">try</span> 
        <span style="color: #009900;">&#123;</span> 
            <span style="color: #666666; font-style: italic;">// Mostramos por pantalla todos los alumnos de la tabla  </span>
            res <span style="color: #339933;">=</span> st.<span style="color: #006633;">executeQuery</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM student INNER JOIN subject ON student.subject = subject.id&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;ID<span style="color: #000099; font-weight: bold;">\t</span>Nombre<span style="color: #000099; font-weight: bold;">\t</span>Apellido Direccion<span style="color: #000099; font-weight: bold;">\t</span>Ciudad<span style="color: #000099; font-weight: bold;">\t</span>Codigo Postal<span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>Email<span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>Movil<span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>Asignatura<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #339933;">+</span> 
                               <span style="color: #0000ff;">&quot;-------------------------------------------------------------------------------------------&quot;</span> <span style="color: #339933;">+</span> 
                               <span style="color: #0000ff;">&quot;--------------------------&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
            <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span>res.<span style="color: #006633;">next</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#123;</span>  
                <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>res.<span style="color: #006633;">getInt</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;id&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> <span style="color: #339933;">+</span> 
                                   res.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;name&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> <span style="color: #339933;">+</span> 
                                   res.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;lastname&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span> &quot;</span> <span style="color: #339933;">+</span> 
                                   res.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;address&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> <span style="color: #339933;">+</span> 
                                   res.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;city&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> <span style="color: #339933;">+</span> 
                                   res.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;pcode&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> <span style="color: #339933;">+</span> 
                                   res.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;email&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> <span style="color: #339933;">+</span> 
                                   res.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;mobile&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> <span style="color: #339933;">+</span> 
                                   res.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;subject&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
&nbsp;
            <span style="color: #666666; font-style: italic;">// Free memory</span>
            res.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a> e<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>  
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">err</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Warning: SELECT JOIN student: &quot;</span> <span style="color: #339933;">+</span> e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> showSubjectByLastName<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> lastname<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">try</span> 
        <span style="color: #009900;">&#123;</span> 
            <span style="color: #666666; font-style: italic;">// Mostramos por pantalla todos los alumnos de la tabla  </span>
            res <span style="color: #339933;">=</span> st.<span style="color: #006633;">executeQuery</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM student WHERE lastname = '&quot;</span> <span style="color: #339933;">+</span> lastname <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;ID<span style="color: #000099; font-weight: bold;">\t</span>Nombre<span style="color: #000099; font-weight: bold;">\t</span>Apellido Direccion<span style="color: #000099; font-weight: bold;">\t</span>Ciudad<span style="color: #000099; font-weight: bold;">\t</span>Codigo Postal<span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>Email<span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>Movil<span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>Asignatura<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #339933;">+</span> 
                               <span style="color: #0000ff;">&quot;-------------------------------------------------------------------------------------------&quot;</span> <span style="color: #339933;">+</span> 
                               <span style="color: #0000ff;">&quot;--------------------------&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
            <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span>res.<span style="color: #006633;">next</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#123;</span>  
                <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>res.<span style="color: #006633;">getInt</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;id&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> <span style="color: #339933;">+</span> 
                                   res.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;name&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> <span style="color: #339933;">+</span> 
                                   res.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;lastname&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span> &quot;</span> <span style="color: #339933;">+</span> 
                                   res.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;address&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> <span style="color: #339933;">+</span> 
                                   res.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;city&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> <span style="color: #339933;">+</span> 
                                   res.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;pcode&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> <span style="color: #339933;">+</span> 
                                   res.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;email&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> <span style="color: #339933;">+</span> 
                                   res.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;mobile&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> <span style="color: #339933;">+</span> 
                                   res.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;subject&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
&nbsp;
            <span style="color: #666666; font-style: italic;">// Free memory</span>
            res.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a> e<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>  
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">err</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Warning: SELECT lastname student: &quot;</span> <span style="color: #339933;">+</span> e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> showSubjects<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">try</span> 
        <span style="color: #009900;">&#123;</span> 
            <span style="color: #666666; font-style: italic;">// Mostramos por pantalla todos las asignaturas de la tabla  </span>
            res <span style="color: #339933;">=</span> st.<span style="color: #006633;">executeQuery</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM subject&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;ID<span style="color: #000099; font-weight: bold;">\t</span>Nombre<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #339933;">+</span> 
                               <span style="color: #0000ff;">&quot;--------------------&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
            <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span>res.<span style="color: #006633;">next</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#123;</span>  
                <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>res.<span style="color: #006633;">getInt</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;id&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> <span style="color: #339933;">+</span> 
                                   res.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;name&quot;</span><span style="color: #009900;">&#41;</span>
                                   <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
&nbsp;
            <span style="color: #666666; font-style: italic;">// Free memory</span>
            res.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a> e<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>  
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">err</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Warning: SELECT subject: &quot;</span> <span style="color: #339933;">+</span> e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> updateSubject<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> data<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// Make a update</span>
        <span style="color: #000000; font-weight: bold;">try</span> 
        <span style="color: #009900;">&#123;</span> 
            st.<span style="color: #006633;">executeUpdate</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;UPDATE subject SET name='&quot;</span> <span style="color: #339933;">+</span> data <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;' WHERE id=0&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a> e<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>  
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">err</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Warning: UPDATE subject: &quot;</span> <span style="color: #339933;">+</span> e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   
        <span style="color: #009900;">&#125;</span> 
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>De la linea 1 a 7 se cargan los archivos necesarios para el funcionamiento del programa.</p>
<p>La linea 9 crea la clase BDprac. En ella tenemos unas <strong>variables globales</strong> a la clase desde la línea 11 a 14, que serán utilizadas para las posteriores consultas y resultados.</p>
<p>La línea 15 es interesante porque especifica el <strong>DBH (Data-Base-Host</strong>), es decir, el enlace o ruta hasta nuestra base de datos. En nuestro caso sera un archivo local, y primero invocaremos al controlador jdbc, seguido de hsqldb e indicaremos que es un <strong>archivo</strong> en la ruta src/ y con el nombre bd. Tambien es posible crear la base de datos en <strong>memoria</strong> como esta comentado en la linea 16.</p>
<p>En las líneas 18-28 tenemos el main, donde se han encapsulado en una serie de métodos todo el funcionamiento del programa (por resultar más didáctico).</p>
<p>Los métodos estan <strong>dispuestos en orden</strong> en el codigo asi que paso a comentarlos brevemente.</p>
<p><strong>loadHSQLDB()</strong> de la línea 30 a 44, se encarga de inicializar o cargar el controlador JDBC y mostrar un mensaje en caso de fallo.</p>
<p><strong>connectDB()</strong> de la línea 46 a 58, se encarga de conectar el controlador HSQLDB a nuestro DBH en la base de datos.</p>
<p><strong>createStatement()</strong> de la línea 60 a 71, prepara una consulta a la base de datos.</p>
<p><strong>dropTables()</strong> de la línea 73 a 84, hace una limpieza inicial (borra si existen) de las tablas que hayan podido usarse en ejecuciones anteriores del programa (para evitar conflictos con antiguas insercciones).</p>
<p><strong>createTables()</strong> de la línea 86 a 128, crea tres tablas, alumnos, asignaturas y la tabla de referencias ajenas alumnos-asignatura.</p>
<p><strong>restoreDB()</strong> de la línea 130 a 141 borra los posibles datos que existieran en las tablas anteriores.</p>
<p><strong>menu()</strong> de la línea 143 a 231, contiene el uso del programa, la lectura de opciones y filtrado de acciones segun el parámetro elegido.</p>
<p><strong>closeHSQLDB()</strong> de la línea 233 a 257, se encarga de cerrar la conexión HSQLDB y finalizar las consultas abiertas. Es ejecutada al finalizar el programa.</p>
<p><strong>read()</strong> de la línea 259 a 272, es un método encargado de la lectura de datos de entrada.</p>
<p><strong>insertData()</strong> de la línea 274 a 300, inserta los datos iniciales en la tablas del programa a modo de ejemplo.</p>
<p><strong>showStudents()</strong> de la línea 302 a 331, muestra todos los alumnos disponibles en la tabla students.</p>
<p><strong>showSubjectByLastName()</strong> de la línea 333 a 362, muestra los alumnos que coincidan en apellido con el filtro de apellido recibido por parámetro lastname.</p>
<p><strong>showSubjects()</strong> de la línea 364 a 386, lista todas las asignaturas disponibles en la tabla subjects.</p>
<p><strong>updateSubject()</strong> de la línea 388 a 399, actualiza el nombre de la asignatura 0 (Literatura) al nombre recibido por parámetro data.</p>
<p>Para que la <strong>compilación y la ejecución</strong> resulte más sencilla, he preparado un archivo Makefile, que establecerá la ruta de HSQLDB y de nuestro directorio de trabajo (y ademas con clean, tiene una opción de borrado de archivos generados):</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Descargar <a href="http://shakaran.es/blog/wp-content/plugins/wp-codebox/wp-codebox.php?p=649&amp;download=Makefile.txt">Makefile.txt</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p6497"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code" id="p649code7"><pre class="shell" style="font-family:monospace;">JAVA_PATH = src/:/usr/share/java/hsqldb.jar:.
BOLD = \033[1m
END  = \033[0m
&nbsp;
all:
	@echo &quot;$(BOLD)&gt;&gt;&gt; Compilando archivos Java... &lt; &lt;&lt;$(END)&quot;
	javac src/BDprac.java 
&nbsp;
	@echo &quot;\n$(BOLD)&gt;&gt;&gt; Ejecutando archivos Java... &lt; &lt;&lt;$(END)&quot;
	java -classpath $(JAVA_PATH) BDprac
&nbsp;
clean:
	$(RM) src/*.class src/*~ src/*.script src/*.properties</pre></td></tr></table></div>

<h2><span style="color: #993300;">Ejemplos de uso</span></h2>
<p>El programa carga el controlador y realiza una <strong>conexión HSQLDB</strong> a un archivo de base de datos creado en tiempo de ejecución (también se puede crear un archivo en memoria, ver línea 16 comentada en el código). Se crean las <strong>tablas iniciales</strong> (alumno y asignaturas) y una tabla para las claves ajenas. También se procede al borrado y vaciado de datos, por si la aplicación ha sido iniciada anteriormente (a modo de limpieza).</p>
<p>Posteriormente aparecerá un <strong>menú</strong> con algunas opciones básicas. Si pretendemos hacer alguna operación sin insertar datos previamente, se nos mostrará un mensaje (por ejemplo metiendo la opción 3 al inicio).</p>
<p>Después de insertar los datos, podemos hacer una <strong>consulta</strong> de todos los alumnos, eligiendo la opción 4.</p>
<p>Si deseamos <strong>cambiar el nombre</strong> de una asignatura (para el ejemplo siempre la 0, de Literatura), elegiremos la opción 2, e introduciremos el nuevo nombre (en este caso Arte). Y con la opción 5 podremos listar las asignaturas antes y después del cambio.</p>
<p>Con la opción 3, podemos <strong>consultar los alumnos</strong> por nombre de apellido, por ejemplo, introduciendo “Garrido” se listan los alumnos con apellido Garrido. Y con 0 finalizaremos la ejecución del programa.</p>
<p><strong>Ejemplo de una traza de ejecución</strong>
</pre>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Descargar <a href="http://shakaran.es/blog/wp-content/plugins/wp-codebox/wp-codebox.php?p=649&amp;download=traza.txt">traza.txt</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p6498"><td class="line_numbers"><pre>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
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
</pre></td><td class="code" id="p649code8"><pre class="text" style="font-family:monospace;">$ make
&gt;&gt;&gt; Compilando archivos Java... &lt; &lt;&lt;
javac src/BDprac.java 
&nbsp;
&gt;&gt;&gt; Ejecutando archivos Java... &lt; &lt;&lt;
java -classpath src/:/usr/share/java/hsqldb.jar:. BDprac
* Starting...
* Loading HSQLDB driver...
* Creating HSQLDB connection...
* Drop table if exists...
* Creating student table...
* Creating subject table...
* Creating student-subject table...
* Restore the original databases, removing all previous inserting data.
	.: Menu :.
	0 - Salir
	1 - Insertar alumnos y asignaturas por defecto.
	2 - Modificar el nombre de una asignatura (0 - Literatura).
	3 - Consultar alumnos por apellido.
	4 - Listar todos los alumnos.
	5 - Listar todas las asignaturas.
&nbsp;
Introduzca una opción numérica:3
Deben insertarse datos previamente.
	.: Menu :.
	0 - Salir
	1 - Insertar alumnos y asignaturas por defecto.
	2 - Modificar el nombre de una asignatura (0 - Literatura).
	3 - Consultar alumnos por apellido.
	4 - Listar todos los alumnos.
	5 - Listar todas las asignaturas.
&nbsp;
Introduzca una opción numérica:1
Datos correctamente insertados.
&nbsp;
	.: Menu :.
	0 - Salir
	1 - Insertar alumnos y asignaturas por defecto.
	2 - Modificar el nombre de una asignatura (0 - Literatura).
	3 - Consultar alumnos por apellido.
	4 - Listar todos los alumnos.
	5 - Listar todas las asignaturas.
&nbsp;
Introduzca una opción numérica:4
ID	Nombre	Apellido Direccion	Ciudad	Codigo Postal		Email		Movil		Asignatura
---------------------------------------------------------------------------------------------------------------------
0	Juan	Garrido	 Sol, 12	Sevilla	13206		j.garrido@gmail.com	609555321	0
1	Luis	Garrido	 Flor, 5	Melilla	43712		l.garrido@gmail.com	615827343	0
2	Teresa	Garcia	 Mata, 18	Madrid	28045		tere.garcia@gmail.com	678123687	1
	.: Menu :.
	0 - Salir
	1 - Insertar alumnos y asignaturas por defecto.
	2 - Modificar el nombre de una asignatura (0 - Literatura).
	3 - Consultar alumnos por apellido.
	4 - Listar todos los alumnos.
	5 - Listar todas las asignaturas.
&nbsp;
Introduzca una opción numérica:
La opción no es un número.
Opcion incorrecta.
&nbsp;
	.: Menu :.
	0 - Salir
	1 - Insertar alumnos y asignaturas por defecto.
	2 - Modificar el nombre de una asignatura (0 - Literatura).
	3 - Consultar alumnos por apellido.
	4 - Listar todos los alumnos.
	5 - Listar todas las asignaturas.
&nbsp;
Introduzca una opción numérica:5
ID	Nombre
--------------------
0	Literatura
1	Ciencia
2	Redes
	.: Menu :.
	0 - Salir
	1 - Insertar alumnos y asignaturas por defecto.
	2 - Modificar el nombre de una asignatura (0 - Literatura).
	3 - Consultar alumnos por apellido.
	4 - Listar todos los alumnos.
	5 - Listar todas las asignaturas.
&nbsp;
Introduzca una opción numérica:2
Introduzca el nuevo nombre para la asignatura 'Literatura':Arte
	.: Menu :.
	0 - Salir
	1 - Insertar alumnos y asignaturas por defecto.
	2 - Modificar el nombre de una asignatura (0 - Literatura).
	3 - Consultar alumnos por apellido.
	4 - Listar todos los alumnos.
	5 - Listar todas las asignaturas.
&nbsp;
Introduzca una opción numérica:5
ID	Nombre
--------------------
0	Arte
1	Ciencia
2	Redes
	.: Menu :.
	0 - Salir
	1 - Insertar alumnos y asignaturas por defecto.
	2 - Modificar el nombre de una asignatura (0 - Literatura).
	3 - Consultar alumnos por apellido.
	4 - Listar todos los alumnos.
	5 - Listar todas las asignaturas.
&nbsp;
Introduzca una opción numérica:3
Introduzca el apellido a consultar:Garrido
ID	Nombre	Apellido Direccion	Ciudad	Codigo Postal		Email		Movil		Asignatura
---------------------------------------------------------------------------------------------------------------------
0	Juan	Garrido	 Sol, 12	Sevilla	13206		j.garrido@gmail.com	609555321	0
1	Luis	Garrido	 Flor, 5	Melilla	43712		l.garrido@gmail.com	615827343	0
	.: Menu :.
	0 - Salir
	1 - Insertar alumnos y asignaturas por defecto.
	2 - Modificar el nombre de una asignatura (0 - Literatura).
	3 - Consultar alumnos por apellido.
	4 - Listar todos los alumnos.
	5 - Listar todas las asignaturas.
&nbsp;
Introduzca una opción numérica:0</pre></td></tr></table></div>

<p>Si lo deseas, puedes<strong> descargar el ejemplo completo</strong> en un archivo empaquetado y comprimido con Gzip en formato tar.gz:</p>
<p>Descargar: <a class="downloadlink" href="http://shakaran.es/blog/downloads/java-jdbc-hsqldb-openoffice-example.tar.gz" title=" descargado 56 veces" >java-jdbc-hsqldb-openoffice-example.tar.gz (56)</a></p>
<p>Nota: todos los datos de alumnos de este artículo son <strong>ficticios</strong>.
</pre>
<br /><div><img src="http://shakaran.es/blog/wp-content/plugins/gd-star-rating/gfx.php?value=9.0" /></div><div>Rating: 9.0/<strong>10</strong> (2 votes cast)</div><br />
<div class="sociable">
<div class="sociable_tagline">
<strong>Comparte, descargalo en pdf, imprimelo o enviaselo a un amigo!</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fshakaran.es%2Fblog%2F2009%2F10%2Fjdbc-y-hsqldb-crear-bases-de-datos-con-java-y-el-motor-de-base-de-datos-de-openoffice%2F&amp;partner=sociable" title="Print"><img src="http://shakaran.es/blog/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fshakaran.es%2Fblog%2F2009%2F10%2Fjdbc-y-hsqldb-crear-bases-de-datos-con-java-y-el-motor-de-base-de-datos-de-openoffice%2F&amp;title=JDBC%20y%20HSQLDB%3A%20crear%20bases%20de%20datos%20con%20Java%20y%20el%20motor%20de%20base%20de%20datos%20de%20OpenOffice&amp;bodytext=%20%20%0D%0AHSQLDB%20es%20un%20sistema%20de%20bases%20de%20datos%20relacional%20SQL%20escrito%20en%20Java%2C%20de%20unos%20600%20kb%20usado%20por%20aplicaciones%20como%20OpenOffice.%20Dispone%20de%20un%20controlador%20JDBC%20y%20ofrece%20un%20peque%C3%B1o%20y%20r%C3%A1pido%20sistema%20de%20bases%20de%20datos%20que%20gestiona%20tablas%20basadas%20en%20d" title="Digg"><img src="http://shakaran.es/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fshakaran.es%2Fblog%2F2009%2F10%2Fjdbc-y-hsqldb-crear-bases-de-datos-con-java-y-el-motor-de-base-de-datos-de-openoffice%2F&amp;title=JDBC%20y%20HSQLDB%3A%20crear%20bases%20de%20datos%20con%20Java%20y%20el%20motor%20de%20base%20de%20datos%20de%20OpenOffice&amp;notes=%20%20%0D%0AHSQLDB%20es%20un%20sistema%20de%20bases%20de%20datos%20relacional%20SQL%20escrito%20en%20Java%2C%20de%20unos%20600%20kb%20usado%20por%20aplicaciones%20como%20OpenOffice.%20Dispone%20de%20un%20controlador%20JDBC%20y%20ofrece%20un%20peque%C3%B1o%20y%20r%C3%A1pido%20sistema%20de%20bases%20de%20datos%20que%20gestiona%20tablas%20basadas%20en%20d" title="del.icio.us"><img src="http://shakaran.es/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fshakaran.es%2Fblog%2F2009%2F10%2Fjdbc-y-hsqldb-crear-bases-de-datos-con-java-y-el-motor-de-base-de-datos-de-openoffice%2F&amp;t=JDBC%20y%20HSQLDB%3A%20crear%20bases%20de%20datos%20con%20Java%20y%20el%20motor%20de%20base%20de%20datos%20de%20OpenOffice" title="Facebook"><img src="http://shakaran.es/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fshakaran.es%2Fblog%2F2009%2F10%2Fjdbc-y-hsqldb-crear-bases-de-datos-con-java-y-el-motor-de-base-de-datos-de-openoffice%2F&amp;title=JDBC%20y%20HSQLDB%3A%20crear%20bases%20de%20datos%20con%20Java%20y%20el%20motor%20de%20base%20de%20datos%20de%20OpenOffice&amp;annotation=%20%20%0D%0AHSQLDB%20es%20un%20sistema%20de%20bases%20de%20datos%20relacional%20SQL%20escrito%20en%20Java%2C%20de%20unos%20600%20kb%20usado%20por%20aplicaciones%20como%20OpenOffice.%20Dispone%20de%20un%20controlador%20JDBC%20y%20ofrece%20un%20peque%C3%B1o%20y%20r%C3%A1pido%20sistema%20de%20bases%20de%20datos%20que%20gestiona%20tablas%20basadas%20en%20d" title="Google Bookmarks"><img src="http://shakaran.es/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://barrapunto.com/submit.pl?subj=JDBC%20y%20HSQLDB%3A%20crear%20bases%20de%20datos%20con%20Java%20y%20el%20motor%20de%20base%20de%20datos%20de%20OpenOffice&amp;story=http%3A%2F%2Fshakaran.es%2Fblog%2F2009%2F10%2Fjdbc-y-hsqldb-crear-bases-de-datos-con-java-y-el-motor-de-base-de-datos-de-openoffice%2F" title="BarraPunto"><img src="http://shakaran.es/blog/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://bitacoras.com/anotaciones/http%3A%2F%2Fshakaran.es%2Fblog%2F2009%2F10%2Fjdbc-y-hsqldb-crear-bases-de-datos-con-java-y-el-motor-de-base-de-datos-de-openoffice%2F" title="Bitacoras.com"><img src="http://shakaran.es/blog/wp-content/plugins/sociable/images/bitacoras.png" title="Bitacoras.com" alt="Bitacoras.com" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://meneame.net/submit.php?url=http%3A%2F%2Fshakaran.es%2Fblog%2F2009%2F10%2Fjdbc-y-hsqldb-crear-bases-de-datos-con-java-y-el-motor-de-base-de-datos-de-openoffice%2F" title="Meneame"><img src="http://shakaran.es/blog/wp-content/plugins/sociable/images/meneame.png" title="Meneame" alt="Meneame" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fshakaran.es%2Fblog%2F2009%2F10%2Fjdbc-y-hsqldb-crear-bases-de-datos-con-java-y-el-motor-de-base-de-datos-de-openoffice%2F&amp;partner=sociable" title="PDF"><img src="http://shakaran.es/blog/wp-content/plugins/sociable/images/pdf.png" title="PDF" alt="PDF" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://shakaran.es/blog/feed/" title="RSS"><img src="http://shakaran.es/blog/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fshakaran.es%2Fblog%2F2009%2F10%2Fjdbc-y-hsqldb-crear-bases-de-datos-con-java-y-el-motor-de-base-de-datos-de-openoffice%2F&amp;title=JDBC%20y%20HSQLDB%3A%20crear%20bases%20de%20datos%20con%20Java%20y%20el%20motor%20de%20base%20de%20datos%20de%20OpenOffice" title="StumbleUpon"><img src="http://shakaran.es/blog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fshakaran.es%2Fblog%2F2009%2F10%2Fjdbc-y-hsqldb-crear-bases-de-datos-con-java-y-el-motor-de-base-de-datos-de-openoffice%2F" title="Technorati"><img src="http://shakaran.es/blog/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
</ul>
</div>


<p>Entradas relacionadas:<ol><li><a href='http://shakaran.es/blog/2009/08/crear-paquetes-deb-de-codigo-python-en-ubuntu/' rel='bookmark' title='Permanent Link: Crear paquetes DEB de código Python en Ubuntu'>Crear paquetes DEB de código Python en Ubuntu</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://shakaran.es/blog/2009/10/jdbc-y-hsqldb-crear-bases-de-datos-con-java-y-el-motor-de-base-de-datos-de-openoffice/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Instalar Jflex y Cup en Ubuntu</title>
		<link>http://shakaran.es/blog/2009/02/instalar-jflex-y-cup-en-ubuntu/</link>
		<comments>http://shakaran.es/blog/2009/02/instalar-jflex-y-cup-en-ubuntu/#comments</comments>
		<pubDate>Sat, 14 Feb 2009 18:39:46 +0000</pubDate>
		<dc:creator>shakaran</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[classpath]]></category>
		<category><![CDATA[cup]]></category>
		<category><![CDATA[instalar]]></category>
		<category><![CDATA[jflex]]></category>
		<category><![CDATA[lalr]]></category>
		<category><![CDATA[path biblioteca]]></category>

		<guid isPermaLink="false">http://shakaran.eshost.es/blog/?p=285</guid>
		<description><![CDATA[Para la instalación es necesario tener habilitados los repositorios Universe. Podemos buscar los paquetes necesarios en Synaptic llamados jflex y cup o bien ejecutamos en consola:

?Descargar instalar-paquetes.txt1
$ sudo apt-get install jflex cup

Para que las bibliotecas esten disponibles al realizar nuestros programas, debemos agregarlas al classpath del sistema. JFlex y Cup se encuentran en:

?Descargar path.txt1
/usr/share/java

Por lo [...]<br /><div><img src="http://shakaran.es/blog/wp-content/plugins/gd-star-rating/gfx.php?value=0.0" /></div><div>Rating: 0.0/<strong>10</strong> (0 votes cast)</div><br />


Entradas relacionadas:<ol><li><a href='http://shakaran.es/blog/2008/08/instalar-transmission-131-en-ubuntu-repositorios-bortis/' rel='bookmark' title='Permanent Link: Instalar Transmission 1.31 en Ubuntu (Repositorios Bortis)'>Instalar Transmission 1.31 en Ubuntu (Repositorios Bortis)</a></li>
<li><a href='http://shakaran.es/blog/2009/11/instalar-django-en-un-servidor-centos-5-4/' rel='bookmark' title='Permanent Link: Instalar Django en un servidor Centos 5.4'>Instalar Django en un servidor Centos 5.4</a></li>
<li><a href='http://shakaran.es/blog/2009/10/instalar-el-interprete-swi-prolog-para-ejecutar-codigo-prolog-en-ubuntu/' rel='bookmark' title='Permanent Link: Instalar el intérprete SWI-Prolog para ejecutar código Prolog en Ubuntu'>Instalar el intérprete SWI-Prolog para ejecutar código Prolog en Ubuntu</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Para la instalación es necesario tener habilitados los repositorios Universe. Podemos buscar los paquetes necesarios en Synaptic llamados jflex y cup o bien ejecutamos en consola:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Descargar <a href="http://shakaran.es/blog/wp-content/plugins/wp-codebox/wp-codebox.php?p=285&amp;download=instalar-paquetes.txt">instalar-paquetes.txt</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p28513"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p285code13"><pre class="shell" style="font-family:monospace;">$ sudo apt-get install jflex cup</pre></td></tr></table></div>

<p>Para que las bibliotecas esten disponibles al realizar nuestros programas, debemos agregarlas al classpath del sistema. JFlex y Cup se encuentran en:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Descargar <a href="http://shakaran.es/blog/wp-content/plugins/wp-codebox/wp-codebox.php?p=285&amp;download=path.txt">path.txt</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p28514"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p285code14"><pre class="shell" style="font-family:monospace;">/usr/share/java</pre></td></tr></table></div>

<p>Por lo tanto, para incluir dichas bibliotecas en el classpath:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Descargar <a href="http://shakaran.es/blog/wp-content/plugins/wp-codebox/wp-codebox.php?p=285&amp;download=path-no-permanente.txt">path-no-permanente.txt</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p28515"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p285code15"><pre class="shell" style="font-family:monospace;">$ export CLASSPATH=$CLASSPATH:/usr/share/java/cup.jar:/usr/share/java/JFlex.jar</pre></td></tr></table></div>

<p>Si queremos que se ejecute en cada sesión y no tener que volver a hacerlo cada vez que iniciamos sesión siendo un cambio permanente, lo incluimos en el bashrc (ejecutandolo una sola vez y en una línea):</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Descargar <a href="http://shakaran.es/blog/wp-content/plugins/wp-codebox/wp-codebox.php?p=285&amp;download=path-permanente.txt">path-permanente.txt</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p28516"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p285code16"><pre class="shell" style="font-family:monospace;">echo &quot;export CLASSPATH=$CLASSPATH:/usr/share/java/cup.jar:/usr/share/java/JFlex.jar&quot; | tee -a ~/.bashrc</pre></td></tr></table></div>

<br /><div><img src="http://shakaran.es/blog/wp-content/plugins/gd-star-rating/gfx.php?value=0.0" /></div><div>Rating: 0.0/<strong>10</strong> (0 votes cast)</div><br />
<div class="sociable">
<div class="sociable_tagline">
<strong>Comparte, descargalo en pdf, imprimelo o enviaselo a un amigo!</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fshakaran.es%2Fblog%2F2009%2F02%2Finstalar-jflex-y-cup-en-ubuntu%2F&amp;partner=sociable" title="Print"><img src="http://shakaran.es/blog/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fshakaran.es%2Fblog%2F2009%2F02%2Finstalar-jflex-y-cup-en-ubuntu%2F&amp;title=Instalar%20Jflex%20y%20Cup%20en%20Ubuntu&amp;bodytext=Para%20la%20instalaci%C3%B3n%20es%20necesario%20tener%20habilitados%20los%20repositorios%20Universe.%20Podemos%20buscar%20los%20paquetes%20necesarios%20en%20Synaptic%20llamados%20jflex%20y%20cup%20o%20bien%20ejecutamos%20en%20consola%3A%0D%0A%24%20sudo%20apt-get%20install%20jflex%20cup%0D%0APara%20que%20las%20bibliotecas%20esten%20dis" title="Digg"><img src="http://shakaran.es/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fshakaran.es%2Fblog%2F2009%2F02%2Finstalar-jflex-y-cup-en-ubuntu%2F&amp;title=Instalar%20Jflex%20y%20Cup%20en%20Ubuntu&amp;notes=Para%20la%20instalaci%C3%B3n%20es%20necesario%20tener%20habilitados%20los%20repositorios%20Universe.%20Podemos%20buscar%20los%20paquetes%20necesarios%20en%20Synaptic%20llamados%20jflex%20y%20cup%20o%20bien%20ejecutamos%20en%20consola%3A%0D%0A%24%20sudo%20apt-get%20install%20jflex%20cup%0D%0APara%20que%20las%20bibliotecas%20esten%20dis" title="del.icio.us"><img src="http://shakaran.es/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fshakaran.es%2Fblog%2F2009%2F02%2Finstalar-jflex-y-cup-en-ubuntu%2F&amp;t=Instalar%20Jflex%20y%20Cup%20en%20Ubuntu" title="Facebook"><img src="http://shakaran.es/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fshakaran.es%2Fblog%2F2009%2F02%2Finstalar-jflex-y-cup-en-ubuntu%2F&amp;title=Instalar%20Jflex%20y%20Cup%20en%20Ubuntu&amp;annotation=Para%20la%20instalaci%C3%B3n%20es%20necesario%20tener%20habilitados%20los%20repositorios%20Universe.%20Podemos%20buscar%20los%20paquetes%20necesarios%20en%20Synaptic%20llamados%20jflex%20y%20cup%20o%20bien%20ejecutamos%20en%20consola%3A%0D%0A%24%20sudo%20apt-get%20install%20jflex%20cup%0D%0APara%20que%20las%20bibliotecas%20esten%20dis" title="Google Bookmarks"><img src="http://shakaran.es/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://barrapunto.com/submit.pl?subj=Instalar%20Jflex%20y%20Cup%20en%20Ubuntu&amp;story=http%3A%2F%2Fshakaran.es%2Fblog%2F2009%2F02%2Finstalar-jflex-y-cup-en-ubuntu%2F" title="BarraPunto"><img src="http://shakaran.es/blog/wp-content/plugins/sociable/images/barrapunto.png" title="BarraPunto" alt="BarraPunto" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://bitacoras.com/anotaciones/http%3A%2F%2Fshakaran.es%2Fblog%2F2009%2F02%2Finstalar-jflex-y-cup-en-ubuntu%2F" title="Bitacoras.com"><img src="http://shakaran.es/blog/wp-content/plugins/sociable/images/bitacoras.png" title="Bitacoras.com" alt="Bitacoras.com" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://meneame.net/submit.php?url=http%3A%2F%2Fshakaran.es%2Fblog%2F2009%2F02%2Finstalar-jflex-y-cup-en-ubuntu%2F" title="Meneame"><img src="http://shakaran.es/blog/wp-content/plugins/sociable/images/meneame.png" title="Meneame" alt="Meneame" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fshakaran.es%2Fblog%2F2009%2F02%2Finstalar-jflex-y-cup-en-ubuntu%2F&amp;partner=sociable" title="PDF"><img src="http://shakaran.es/blog/wp-content/plugins/sociable/images/pdf.png" title="PDF" alt="PDF" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://shakaran.es/blog/feed/" title="RSS"><img src="http://shakaran.es/blog/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fshakaran.es%2Fblog%2F2009%2F02%2Finstalar-jflex-y-cup-en-ubuntu%2F&amp;title=Instalar%20Jflex%20y%20Cup%20en%20Ubuntu" title="StumbleUpon"><img src="http://shakaran.es/blog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fshakaran.es%2Fblog%2F2009%2F02%2Finstalar-jflex-y-cup-en-ubuntu%2F" title="Technorati"><img src="http://shakaran.es/blog/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
</ul>
</div>


<p>Entradas relacionadas:<ol><li><a href='http://shakaran.es/blog/2008/08/instalar-transmission-131-en-ubuntu-repositorios-bortis/' rel='bookmark' title='Permanent Link: Instalar Transmission 1.31 en Ubuntu (Repositorios Bortis)'>Instalar Transmission 1.31 en Ubuntu (Repositorios Bortis)</a></li>
<li><a href='http://shakaran.es/blog/2009/11/instalar-django-en-un-servidor-centos-5-4/' rel='bookmark' title='Permanent Link: Instalar Django en un servidor Centos 5.4'>Instalar Django en un servidor Centos 5.4</a></li>
<li><a href='http://shakaran.es/blog/2009/10/instalar-el-interprete-swi-prolog-para-ejecutar-codigo-prolog-en-ubuntu/' rel='bookmark' title='Permanent Link: Instalar el intérprete SWI-Prolog para ejecutar código Prolog en Ubuntu'>Instalar el intérprete SWI-Prolog para ejecutar código Prolog en Ubuntu</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://shakaran.es/blog/2009/02/instalar-jflex-y-cup-en-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
