<?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"
	>

<channel>
	<title>Lo aprendi en la U</title>
	<atom:link href="http://robertogt.blogs.com.gt/feed/" rel="self" type="application/rss+xml" />
	<link>http://robertogt.blogs.com.gt</link>
	<description>Just another Blogs.com.gt weblog</description>
	<pubDate>Thu, 29 May 2008 04:40:03 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Conectar MySql y Java</title>
		<link>http://robertogt.blogs.com.gt/2008/04/16/conectar-mysql-y-java/</link>
		<comments>http://robertogt.blogs.com.gt/2008/04/16/conectar-mysql-y-java/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 06:20:01 +0000</pubDate>
		<dc:creator>robertogt</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://robertogt.blogs.com.gt/2008/04/16/conectar-mysql-y-java/</guid>
		<description><![CDATA[La conexión entre MySql y Java es sencilla. Creamos una clase que es donde va a estar el codigo para hacer la conexión: por ejemplo:
import java.sql.*;
public class Conexion {
Connection cn;
PreparedStatement pst;
public Conexion() {
try
{
Class.forName(&#8221;com.mysql.jdbc.Driver&#8221;);
String url = &#8220;jdbc:mysql://localhost:3306/MiBaseDeDatos&#8221;;
cn= DriverManager.getConnection( url, &#8220;root&#8221;,&#8221;password&#8221; );
}
catch(Exception ee)
{
System.out.println(&#8221;Error: &#8221; + ee.getMessage());
}
}
Luego tenemos que bajarnos el conector aqui , si es en windows, [...]]]></description>
			<content:encoded><![CDATA[<p>La conexión entre MySql y Java es sencilla. Creamos una clase que es donde va a estar el codigo para hacer la conexión: por ejemplo:</p>
<p>import java.sql.*;<br />
<code>public class Conexion {</code></p>
<p><code>Connection cn;<br />
PreparedStatement pst;<br />
public Conexion() {</code></p>
<p>try<br />
{<br />
Class.forName(&#8221;com.mysql.jdbc.Driver&#8221;);<br />
String url = &#8220;jdbc:mysql://localhost:3306/MiBaseDeDatos&#8221;;<br />
cn= DriverManager.getConnection( url, &#8220;root&#8221;,&#8221;password&#8221; );<br />
}<br />
catch(Exception ee)<br />
{<br />
System.out.println(&#8221;Error: &#8221; + ee.getMessage());<br />
}<br />
}<br />
Luego tenemos que bajarnos el conector <a href="http://dev.mysql.com/downloads/connector/j/5.1.html" title="conector java sql">aqui</a> , si es en windows, nos bajamos el .zip, sino el otro.</p>
<p>Luego descomprimimos el .rar donde sea, y luego  buscamos el <strong>mysql-connector-java-5.1.6-bin.jar.</strong></p>
<p>Este Jar lo pegamos en la carpeta &#8220;lib&#8221; dentro del la carpeta del &#8220;jdk&#8221;, en mi computadora la dirección es: <strong>C:\jdk1.6.0\lib</strong></p>
<p>Luego lo agregamos a nuestro proyecto, por ejemplo en NetBeans los Jar se agregan de esta forma:</p>
<p>En la pestaña &#8220;Proyects&#8221; buscamos la carpeta Libraries</p>
<blockquote>
<blockquote><p> <a href="http://robertogt.blogs.com.gt/files/2008/04/agregar-jar.JPG" title="agregar jar"><img src="http://robertogt.blogs.com.gt/files/2008/04/agregar-jar.JPG" alt="agregar jar" height="512" width="334" /></a></p></blockquote>
</blockquote>
<p>Damos clic derecho sobre Libraries y seleccionamos Add Jar/File.</p>
<p>En otro post publicare como hacer INSERT, SELECT sobre una base de datos Mysql</p>
]]></content:encoded>
			<wfw:commentRss>http://robertogt.blogs.com.gt/2008/04/16/conectar-mysql-y-java/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
