<?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>Vive-libre.com &#187; LINUX</title>
	<atom:link href="http://vive-libre.com/blog/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://vive-libre.com/blog</link>
	<description>Un espacio, para la libertad.</description>
	<lastBuildDate>Thu, 24 Dec 2009 18:25:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Como cambiar la contraseña de MySQL</title>
		<link>http://vive-libre.com/blog/2008/04/06/como-cambiar-la-contrasena-de-mysql/</link>
		<comments>http://vive-libre.com/blog/2008/04/06/como-cambiar-la-contrasena-de-mysql/#comments</comments>
		<pubDate>Sun, 06 Apr 2008 22:27:23 +0000</pubDate>
		<dc:creator>yovany</dc:creator>
				<category><![CDATA[LINUX]]></category>
		<category><![CDATA[MYSQL]]></category>
		<category><![CDATA[UBUNTU]]></category>
		<category><![CDATA[USUARIOS]]></category>

		<guid isPermaLink="false">http://vive-libre.com/blog/2008/04/06/como-cambiar-la-contrasena-de-mysql/</guid>
		<description><![CDATA[Hay veces que al instalar el mysql, tenemos el problema de
Error
MySQL ha dicho:
#1045 - Access denied for user: 'user@localhost' (Using password: YES)
Si olvidamos la contrasena o de plano nunca la tuvimos y necesitamos logearnos en mysql. La solucion es la siguiente.
Primero hay que deterner el servidor de mysql
PLAIN TEXT
CODE:




/etc/init.d/mysql stop 






Despues iniciaremos el servidor en [...]]]></description>
			<content:encoded><![CDATA[<p>Hay veces que al instalar el mysql, tenemos el problema de</p>
<p>Error<br />
MySQL ha dicho:</p>
<p>#1045 - Access denied for user: 'user@localhost' (Using password: YES)</p>
<p>Si olvidamos la contrasena o de plano nunca la tuvimos y necesitamos logearnos en mysql. La solucion es la siguiente.</p>
<p>Primero hay que deterner el servidor de mysql</p>
<div class="igBar"><span id="lcode-4"><a href="#" onclick="javascript:showPlainTxt('code-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-4">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">/etc/init.<span style="">d</span>/mysql stop </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Despues iniciaremos el servidor en modo seguro, ignorando las tablas de permisos</p>
<p>/usr/bin/mysqld_safe --skip-grant-tables &amp;</p>
<p>Con esto podemos entrar a mysq, le indicamos que la tabla a usar es mysql y ejecutamos una consulta que nos permitira cambiar la contrasena actual del usuario que necesitemos , despues de ejecutar la consulta, reiniciamos los privilegios, por ultimo salimos.</p>
<div class="igBar"><span id="lcode-5"><a href="#" onclick="javascript:showPlainTxt('code-5'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-5">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mysql</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">use mysql;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">UPDATE user SET Password=PASSWORD<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'nueva_contraseña'</span><span style="color:#006600; font-weight:bold;">&#41;</span> WHERE User=\<span style="color:#CC0000;">"root<span style="color:#000099; font-weight:bold;">\"</span>;</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0000;">flush privileges;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0000;">exit </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Y solo nos queda detener el de nuevo el servidoe de mysql y volverlo a iniciar</p>
<div class="igBar"><span id="lcode-6"><a href="#" onclick="javascript:showPlainTxt('code-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-6">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">/etc/init.<span style="">d</span>/mysql stop</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">/etc/init.<span style="">d</span>/mysql start </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Esto lo he provado en ubuntu 7.4 y 7.10</p>
]]></content:encoded>
			<wfw:commentRss>http://vive-libre.com/blog/2008/04/06/como-cambiar-la-contrasena-de-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mini How-to Ubuntu, Java y MySQL Parte 4</title>
		<link>http://vive-libre.com/blog/2008/04/06/mini-how-to-ubuntu-java-y-mysql-parte-4/</link>
		<comments>http://vive-libre.com/blog/2008/04/06/mini-how-to-ubuntu-java-y-mysql-parte-4/#comments</comments>
		<pubDate>Sun, 06 Apr 2008 05:58:12 +0000</pubDate>
		<dc:creator>yovany</dc:creator>
				<category><![CDATA[JAVA]]></category>
		<category><![CDATA[LINUX]]></category>
		<category><![CDATA[MYSQL]]></category>
		<category><![CDATA[UBUNTU]]></category>
		<category><![CDATA[CODIGO]]></category>

		<guid isPermaLink="false">http://vive-libre.com/blog/2008/04/06/mini-how-to-ubuntu-java-y-mysql-parte-4/</guid>
		<description><![CDATA[Que tal pues seguimos con la saga, en esta parte veremos como hacer consultas desde la interfas grafica, empecemos.
Consultas a MySQL desde interfas grafica con NETBEANS.
Para empesar hay que crear un archivo nuevo,  Formulario GUI JAVA &#62; Formulario JFrame &#62;

Despues le asignamos un nombre que en este caso sera CONSULTAS y le damos terminar.

Ya [...]]]></description>
			<content:encoded><![CDATA[<p>Que tal pues seguimos con la saga, en esta parte veremos como hacer consultas desde la interfas grafica, empecemos.</p>
<p>Consultas a MySQL desde interfas grafica con NETBEANS.</p>
<p>Para empesar hay que crear un archivo nuevo,  Formulario GUI JAVA &gt; Formulario JFrame &gt;</p>
<p><img src="http://lh5.google.com/blue.star.boy/R-xRqwrZ52I/AAAAAAAAA1g/m1rq2JOLwn8/s800/Pantallazo-17.png" /></p>
<p>Despues le asignamos un nombre que en este caso sera CONSULTAS y le damos terminar.</p>
<p><img src="http://lh4.google.com/blue.star.boy/R-xRqgrZ51I/AAAAAAAAA1Y/VbHQtSD6os4/s800/Pantallazo-18.png" /></p>
<p>Ya que tenemos nuestro JFrame vamos a garegar una caja de texto un boton y una tabla que es donde vamos a visualizar los resultados de la consulta, al final obtendremos algo asi.</p>
<p><img src="http://lh6.google.com/blue.star.boy/R-xUBArZ53I/AAAAAAAAA1o/4P1KJKM2fek/s800/Pantallazo-20.png" /></p>
<p>Ahora, recordando la estructura de la base de datos que hemos estado usando, los campos que tenemos disponibles son los siguientes:</p>
<p>CREATE TABLE DATOS<br />
<span style="color: #006600; font-weight: bold">(</span><br />
NOMBRE VARCHAR<span style="color: #006600; font-weight: bold">(</span><span style="color: #800000">25</span><span style="color: #006600; font-weight: bold">)</span>,<br />
TELEFONO VARCHAR<span style="color: #006600; font-weight: bold">(</span><span style="color: #800000">15</span><span style="color: #006600; font-weight: bold">)</span>,<br />
CORREO VARCHAR<span style="color: #006600; font-weight: bold">(</span><span style="color: #800000">25</span><span style="color: #006600; font-weight: bold">)</span>,<br />
TWITTER VARCHAR<span style="color: #006600; font-weight: bold">(</span><span style="color: #800000">30</span><span style="color: #006600; font-weight: bold">)</span><br />
<span style="color: #006600; font-weight: bold">)</span>;</p>
<p>Los resultados que vamos a obtener de la consulta, los vamos a recibir en la tabla, por lo mismo la tabla debe de tener las mismas columnas, estas tablas no son tan dinamicas, como los arreglos en C o demas lenguajes, (o al menos no le he encontrado la forma : ) si saben se aceptan sugerencias ). Para modificar las propiedades de la tabla como columnas, filas, y tipos de datos que albergaran las columnas hay que seleccionar el objeto tabla, y dirigirse a la columna derecha, donde se encuantra la seccion de propiedades, ahi buscaremos el atributo de "MODEL", este atributo no tiene ningun valor, pero tiene un boton al final de campo con tres puntos [...], al dar click en el boton nos mostrara el menu, de la propiedades de la tabla.</p>
<p><img src="http://lh6.google.com/blue.star.boy/R-xazArZ56I/AAAAAAAAA10/FzUbeLa5hTs/s800/Pantallazo-21.png" /></p>
<p>En esta ventana modificaremos el nombre de las columnas que tiene la tabla segun sea el caso, y el tipo de datos que contendra la columna, lo podemos dejar como Object, pero lo cambiaremos a String. En la pestana de Valores predeterminados podremos ver una vista previa de la tabla, ademas de poder agregar columnas y filas con los botones que se encuentran en la parte inferior izquierda. Al termniar obtendremos esto:</p>
<p><img src="http://lh4.google.com/blue.star.boy/R-xccgrZ57I/AAAAAAAAA18/h9z0v_Mx9hQ/s800/Pantallazo-22.png" /></p>
<p>Teniedo el formulario listo, empezaremos con la programacion de la consulta a mysql. Cambiaremos el nombre de la caja de texto para manejarlo mas facil, para nuestro caso se llamara txtNombre.</p>
<p>Agregaremos un evento al boton de tipo mouseReleased para hacer la consulta y ahi debe ir el siguiente codigo:</p>
<div class="igBar"><span id="lcode-8"><a href="#" onclick="javascript:showPlainTxt('code-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-8">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">int j=<span style="color:#800000;color:#800000;">0</span>,i=<span style="color:#800000;color:#800000;">0</span>;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//Esta es la cadena a ejecutar en el servido de mysql se le pasa como parametro txtNombre, que es la caja de texto //donde se introduce el nombre a buscar, con el metodo getTex(), para obtener el texto introducido, y toStrin() para //convertir a String la cadena de la caja del texto.</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">String cadena=<span style="color:#CC0000;">"SELECT * FROM DATOS WHERE NOMBRE LIKE '%"</span>+txtNobre.<span style="">getText</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">toString</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>+<span style="color:#CC0000;">"%';"</span>;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//No olvidar que las conexiones siempre se manejan dentro de try, para el manejo de excepciones de lo contrario siempre //les manejara un error aun que el codigo este bien</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">try</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//Le indicamos el&nbsp; driver a usar</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Class.<span style="">forName</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"com.mysql.jdbc.Driver"</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">newInstance</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//Le indicamos los datos correspondientes en la cadena de conexion, ip del servido, Base de datos usuario y pass</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">conexion=DriverManager.<span style="">getConnection</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"jdbc:mysql://127.0.0.1:3306/AGENDA"</span>,<span style="color:#CC0000;">"user"</span>,<span style="color:#CC0000;">"passwd"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sentencia=conexion.<span style="">createStatement</span><span style="color:#006600; font-weight:bold;">&#40;</span>ResultSet.<span style="">TYPE_SCROLL_INSENSITIVE</span>,ResultSet.<span style="">CONCUR_READ_ONLY</span> <span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//Aqui ejecutamos la sentencia de la consulta</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resultado=sentencia.<span style="">executeQuery</span><span style="color:#006600; font-weight:bold;">&#40;</span>cadena<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//Mientras la consulta arroje resultados va entrar al while</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">while<span style="color:#006600; font-weight:bold;">&#40;</span>resultado.<span style="">next</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//El for nos servira para ir recorriendo los datos que recojimos de la consulta, el contador comienza en uno (no en cero //como los areglos en C) el indice i nos servira para ir pasando de columna en columna, tanto en la tabla como en los //resultados de la consulta,el indice j sera para ir saltando de fila en fila despues de cada recorrido de columnas</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">for<span style="color:#006600; font-weight:bold;">&#40;</span>i=<span style="color:#800000;color:#800000;">1</span>;i&amp;lt;=<span style="color:#800000;color:#800000;">4</span>;i++<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Tabla.<span style="">setValueAt</span><span style="color:#006600; font-weight:bold;">&#40;</span>resultado.<span style="">getString</span><span style="color:#006600; font-weight:bold;">&#40;</span>i<span style="color:#006600; font-weight:bold;">&#41;</span>,j,i-<span style="color:#800000;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">j=j+<span style="color:#800000;color:#800000;">1</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//Por ultimo el catch para manejar las excepciones si entra al catch mandaremos a imprimir la variable e que es donde se //guardara el mensaje de la excepcion</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">catch<span style="color:#006600; font-weight:bold;">&#40;</span>Exception e<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">JOptionPane.<span style="">showMessageDialog</span><span style="color:#006600; font-weight:bold;">&#40;</span>null,<span style="color:#CC0000;">"error: "</span>+e<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Y aqui esta la prueba (Las etiquetas estan al reves pero nada de importancia <img src='http://vive-libre.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> ).</p>
<p><img src="http://lh4.google.com/blue.star.boy/R_lJkQrZ58I/AAAAAAAAA2g/IGdGUGIzpzM/s800/Pantallazo-23.png" /><br />
Y listo espero les sirva de ayuda, comentarios, quejas o sujerencias ya saben a donde <img src='http://vive-libre.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Saludos</p>
]]></content:encoded>
			<wfw:commentRss>http://vive-libre.com/blog/2008/04/06/mini-how-to-ubuntu-java-y-mysql-parte-4/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Mini How-to Ubuntu, Java y MySQL Parte 2</title>
		<link>http://vive-libre.com/blog/2008/02/29/mini-how-to-ubuntu-java-y-mysql-parte-2/</link>
		<comments>http://vive-libre.com/blog/2008/02/29/mini-how-to-ubuntu-java-y-mysql-parte-2/#comments</comments>
		<pubDate>Fri, 29 Feb 2008 16:51:39 +0000</pubDate>
		<dc:creator>yovany</dc:creator>
				<category><![CDATA[JAVA]]></category>
		<category><![CDATA[LINUX]]></category>
		<category><![CDATA[MYSQL]]></category>
		<category><![CDATA[UBUNTU]]></category>
		<category><![CDATA[CONEXION]]></category>

		<guid isPermaLink="false">http://vive-libre.com/blog/2008/02/29/mini-how-to-ubuntu-java-y-mysql-parte-2/</guid>
		<description><![CDATA[Como lo prometido es deuda aqui esta la segunda parte del mini tutorial de JAVA y MySQL ahora veremos la parte de la conexion a MySQL desde JAVA.
La Base de Datos
Para poder hacer la practica debemos crear la siguiente base de datos ya que la conexion hara referencia a los campos que estan aqui.
Para entrar [...]]]></description>
			<content:encoded><![CDATA[<p>Como lo prometido es deuda aqui esta la segunda parte del mini tutorial de JAVA y MySQL ahora veremos la parte de la conexion a MySQL desde JAVA.<br />
La Base de Datos<br />
Para poder hacer la practica debemos crear la siguiente base de datos ya que la conexion hara referencia a los campos que estan aqui.</p>
<p>Para entrar en mysql, en la consola haremos lo siguiente</p>
<div class="igBar"><span id="lcode-16"><a href="#" onclick="javascript:showPlainTxt('code-16'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-16">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$ mysql -u nuestro_usuario -p </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Ojo el usuario con el que vamos a entrar es con el que instalamos mysql, ya que es el que tiene configurado el password en mysql mas adelante veremos como asignar mas usuarios y passsword para mysql.</p>
<p>Una vez que nos haya pedido el password nos mostrara el promp de mysql algo asi:</p>
<div class="igBar"><span id="lcode-17"><a href="#" onclick="javascript:showPlainTxt('code-17'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-17">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Welcome to the MySQL monitor.&nbsp; <span style="">Commands</span> end with ; or \g.</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="">Your</span> MySQL connection id is <span style="color:#800000;color:#800000;">10</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Server version: <span style="color:#800000;color:#800000;">5</span>.<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">45</span>-Debian_1ubuntu3.<span style="color:#800000;color:#800000;">1</span>-log Debian etch distribution</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Type <span style="color:#CC0000;">'help;'</span> or <span style="color:#CC0000;">'<span style="color:#000099; font-weight:bold;">\h</span>'</span> for help. <span style="">Type</span> <span style="color:#CC0000;">'<span style="color:#000099; font-weight:bold;">\c</span>'</span> to clear the buffer.</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="">mysql</span>&amp;gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Ahora teclearemos lo siguiente atencion de poner ; (punto y coma) al final de cada sentencia de lo contrario asumira que el comando aun continua.</p>
<div class="igBar"><span id="lcode-18"><a href="#" onclick="javascript:showPlainTxt('code-18'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-18">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">CREATE DATABASE AGENDA;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">USE AGENDA;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">CREATE TABLE DATOS</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">NOMBRE VARCHAR<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">25</span><span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">TELEFONO VARCHAR<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">15</span><span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">CORREO VARCHAR<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">25</span><span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">TWITTER VARCHAR<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">30</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">INSERT INTO DATOS VALUES<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'ALAN GASCA'</span>,<span style="color:#CC0000;">'57803747'</span>,<span style="color:#CC0000;">'blue.star.boy@gmail.com'</span>,<span style="color:#CC0000;">'www.twitter.com/yovany'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">INSERT INTO DATOS VALUES<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'ALMA DELIA'</span>,<span style="color:#CC0000;">'26461263'</span>,<span style="color:#CC0000;">'almawook@yahoo.com'</span>,<span style="color:#CC0000;">'www.twitter.com/alma'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Con esto abremos creado una base de datos que se llama agenda, le indicamos que agenda es la base de datos donde vamos a trabajar, creamos una tabla que se llama datos e insertamos unos valores para poder ver los resultados de la practica.</p>
<p>Ahora vamos con JAVA</p>
<div class="igBar"><span id="lcode-19"><a href="#" onclick="javascript:showPlainTxt('code-19'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-19">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">import java.<span style="">awt</span>.*;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">import java.<span style="">sql</span>.*;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">import java.<span style="">util</span>.*;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">import javax.<span style="">swing</span>.*;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">import java.<span style="">io</span>.*;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">import java.<span style="">net</span>.*;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">public class agenda</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">public String BD=<span style="color:#CC0000;">"AGENDA"</span>;&nbsp; &nbsp; &nbsp;<span style="color:#FF9933; font-style:italic;">// ESTA VARIABLE GUARDA EL NOMBRE DE LA BASE DE DATOS A LA QUE NOS VAMOS A CONECTAR</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">public String consulta=<span style="color:#CC0000;">"SELECT * FROM DATOS"</span>;<span style="color:#FF9933; font-style:italic;">// ESTA GUARDA LA CONSULTA SQL QUE SE VA A EJECUTAR EN LA BD</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">public String USUARIO=<span style="color:#CC0000;">"mi_usuario"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">public String PASS=<span style="color:#CC0000;">"mi_paswd"</span>;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">public Connection conexion=null;&nbsp; <span style="color:#FF9933; font-style:italic;">// LAS VARIABLES PARA PODER GENERAR LA CONEXION A LA BD</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">public Statement sentencia=null;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">public ResultSet resultado=null;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">public agenda<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">try</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//LE INDICAMOS A JAVA CUAL ES EL DRIVER QUE VAMOS A UTILIZAR</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Class.<span style="">forName</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"com.mysql.jdbc.Driver"</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">newInstance</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//ESTA ES NUESTRA CADENA DE CONEXION LE INDICAMOS CUAL ES LA SIRRCION IP DEL SERVIDOR DE MYSQL</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//ADEMAS DE LA BASE DE DATOS A LA QUE SE VA A CONECTAR ASI COMO EL USUARIO Y PASSWORD</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//RECUERDEN QUE ES EL USUARION CON EL QUE SE INSTALO MYSQL</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">conexion=DriverManager.<span style="">getConnection</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"jdbc:mysql://127.0.0.1:3306/"</span>+BD,USUARIO,PASS<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sentencia=conexion.<span style="">createStatement</span><span style="color:#006600; font-weight:bold;">&#40;</span>ResultSet.<span style="">TYPE_SCROLL_INSENSITIVE</span>,ResultSet.<span style="">CONCUR_READ_ONLY</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//ESTA VARIABLE ES LA QUE VA GUARDAR LOS RESULTADOS QUE GENERE LA CONSULTA</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//EL EXECUTEQUERY ES EL METODO QUE EJECUTA LA CONSULTA</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resultado=sentencia.<span style="">executeQuery</span><span style="color:#006600; font-weight:bold;">&#40;</span>consulta<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//SI LA CONSULTA RETORNA VALORES LA VARIABLE RESULTADO SE UBICARA UNA POCOSION</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//ANTES DEL PRIMER VALOR, ENTONCES SI SE CUMPLE QUE EXISTA UN VALOR EN LA SIGUIENTE</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//POCISION EN TRARA AL WHILE</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">while<span style="color:#006600; font-weight:bold;">&#40;</span>resultado.<span style="">next</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//Y SE IMPRIMIRAN LOS VALORES DE LA CONSULTA, QUE SE OBTIENEN CON GETSTRING, SE LE PUEDE PASAR EL NUMERO O NOMBRE DE LA COLUMNA DE LA TABLA</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">System.<span style="">out</span>.<span style="">println</span><span style="color:#006600; font-weight:bold;">&#40;</span>resultado.<span style="">getString</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"NOMBRE"</span><span style="color:#006600; font-weight:bold;">&#41;</span>+<span style="color:#CC0000;">" | "</span>+resultado.<span style="">getString</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"TELEFONO"</span><span style="color:#006600; font-weight:bold;">&#41;</span>+<span style="color:#CC0000;">" | "</span>+resultado.<span style="">getString</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"CORREO"</span><span style="color:#006600; font-weight:bold;">&#41;</span>+<span style="color:#CC0000;">" | "</span>+resultado.<span style="">getString</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"TWITTER"</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span>System.<span style="">out</span>.<span style="">println</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"Estos son los datos de la agenda... "</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//TODO ESTO DEVE SIEMPRE DE IR DENTRO DE UN TRY, DE LO CONTRARIO NOS MARCAR UN ERROR</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">catch<span style="color:#006600; font-weight:bold;">&#40;</span>Exception error<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">System.<span style="">out</span>.<span style="">println</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"Error: "</span>+error<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">public static void main<span style="color:#006600; font-weight:bold;">&#40;</span> String<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span> arg <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">agenda miAgenda = new agenda<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Para probar el codigo debemos ejecutarlo de la siguiente manera, primero debemos cambiarnos a la carpeta donde esta ubicado el archivo agenda.java y tecleamos lo siguiente</p>
<div class="igBar"><span id="lcode-20"><a href="#" onclick="javascript:showPlainTxt('code-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-20">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">javac agenda.<span style="">java</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Si no obtenemos ningun error, lo ejecutamos asi</p>
<div class="igBar"><span id="lcode-21"><a href="#" onclick="javascript:showPlainTxt('code-21'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-21">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">java agenda </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Y obtendremos esto</p>
<div class="igBar"><span id="lcode-22"><a href="#" onclick="javascript:showPlainTxt('code-22'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-22">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ALAN GASCA | <span style="color:#800000;color:#800000;">57803747</span> | blue.<span style="">star</span>.<span style="">boy</span>@gmail.<span style="">com</span> | www.<span style="">twitter</span>.<span style="">com</span>/yovany</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ALMA DELIA | <span style="color:#800000;color:#800000;">26461263</span> | almawook@yahoo.<span style="">com</span> | www.<span style="">twitter</span>.<span style="">com</span>/alma </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Espero sea claro en la siguiente parte haremos una insercion y consulta con una interfas grafica, con netbeans, ojala les sea de utilidad.</p>
]]></content:encoded>
			<wfw:commentRss>http://vive-libre.com/blog/2008/02/29/mini-how-to-ubuntu-java-y-mysql-parte-2/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Como instalar Webmin en Ubuntu 7.4</title>
		<link>http://vive-libre.com/blog/2008/02/28/como-instalar-webmin-en-ubuntu-74/</link>
		<comments>http://vive-libre.com/blog/2008/02/28/como-instalar-webmin-en-ubuntu-74/#comments</comments>
		<pubDate>Thu, 28 Feb 2008 15:51:53 +0000</pubDate>
		<dc:creator>yovany</dc:creator>
				<category><![CDATA[LINUX]]></category>
		<category><![CDATA[UBUNTU]]></category>
		<category><![CDATA[JAVA]]></category>
		<category><![CDATA[MYSQL]]></category>

		<guid isPermaLink="false">http://vive-libre.com/blog/2008/02/28/como-instalar-webmin-en-ubuntu-74/</guid>
		<description><![CDATA[Para poderlo instalar debemos bajar el paquete de esta [pagina] el paquete mas actual a la fecha es el 1.370 y lo bajamos con este [ link]. Ya que tengamos el paquete hay que instalar las dependencias siguientes:
- libnet-ssleay-perl
- libmd5-perl
- libauthen-pam-perl
- libpam-runtime
- libio-pty-perl
Y lo hacemos en una consola con el soguiente comando:
PLAIN TEXT
CODE:




$ sudo apt-get [...]]]></description>
			<content:encoded><![CDATA[<p><font color="#ff6600">Para poderlo instalar debemos bajar el paquete de esta [<a href="http://www.webmin.com/download.html">pagina</a>] el paquete mas actual a la fecha es el 1.370 y lo bajamos con este [<a href="http://prdownloads.sourceforge.net/webadmin/webmin_1.370_all.deb"> link</a>]. Ya que tengamos el paquete hay que instalar las dependencias siguientes:</font></p>
<p><font color="#ff6600">- libnet-ssleay-perl<br />
- libmd5-perl<br />
- libauthen-pam-perl<br />
- libpam-runtime<br />
- libio-pty-perl</font></p>
<p><font color="#ff6600">Y lo hacemos en una consola con el soguiente comando:</p>
<div class="igBar"><span id="lcode-27"><a href="#" onclick="javascript:showPlainTxt('code-27'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-27">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$ sudo apt-get install libnet-ssleay-perl libmd5-perl libauthen-pam-perl libpam-runtime libio-pty-perl </div>
</li>
</ol>
</div>
</div>
</div>
<p></font></p>
<p><font color="#ff6600">Despues ubicarnos en la carpeta donde se descargo el paquete y lo instalamos:</font></p>
<p><font color="#ff6600">
<div class="igBar"><span id="lcode-28"><a href="#" onclick="javascript:showPlainTxt('code-28'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-28">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$sudo dpkg -i webmin_1.<span style="color:#800000;color:#800000;">370</span>_all.<span style="">deb</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></font></p>
<p><font color="#ff6600">Ya esta instalado ahora solo debemos cambiar la contrasena de root al<br />
webmin:</font></p>
<p><font color="#ff6600">
<div class="igBar"><span id="lcode-29"><a href="#" onclick="javascript:showPlainTxt('code-29'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-29">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#/usr/share/webmin/changepass.<span style="">pl</span> /etc/webmin/ root nueva_contrasena </div>
</li>
</ol>
</div>
</div>
</div>
<p></font></p>
<p><font color="#ff6600">
<div class="igBar"><span id="lcode-30"><a href="#" onclick="javascript:showPlainTxt('code-30'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-30">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#/usr/libexec/webmin/changepass.<span style="">pl</span> /etc/webmin/ root nueva_contrasena </div>
</li>
</ol>
</div>
</div>
</div>
<p></font></p>
<p><font color="#ff6600">Y Listo puedes probarlo en tu navegador favorito poniendo la siguiente<br />
direccion https://localhost:10000/ aqui te pedira un usuario y contrasena<br />
que son las que acabamos de modificar.</font></p>
<p><font color="#ff6600">Espero les sirva<br />
XD</font></p>
]]></content:encoded>
			<wfw:commentRss>http://vive-libre.com/blog/2008/02/28/como-instalar-webmin-en-ubuntu-74/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>
