<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7897005543381843758</id><updated>2024-09-12T08:31:16.351+02:00</updated><category term="base de datos"/><category term="java"/><category term="mysql"/><title type='text'>Programadores con futuro</title><subtitle type='html'>Desarrollo de aplicaciones en JAVA, tutoriales, conexiones a base de datos, todo paso a paso.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://programadoresconfuturo.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7897005543381843758/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://programadoresconfuturo.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>k0balt0</name><uri>http://www.blogger.com/profile/16776937486057958916</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiy91BpX1hICZzMF6jy1cRlKRVUmk1GT33_Vyb6AcJ9XxV7Qdl1elgadV23I3tMSQWuMv-pmrMyOqJsY5JvB48JwW3T-Jch3MGnbXjrwLSdX0O1ba4xk35MUF8kNuqDQA/s220/IMGP2129.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>2</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7897005543381843758.post-2827930655995387379</id><published>2010-01-26T13:09:00.004+01:00</published><updated>2010-01-26T13:13:24.180+01:00</updated><title type='text'>Conectar JAVA con MySQL (parte 2) : Preparando MySQL</title><content type='html'>&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Bueno, ya estamos de vuelta con la segunda entrega de este blog. &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Una vez configurado el driver para conectar MySQL a JAVA (ver entrada anterior del blog)  tendremos que realizar la conexión mediante código. Para eso os presentaré la clase DATA (en el siguiente articulo, en este veremos la previa configuración de MySQL), que es una clase que me creé hace un tiempo y la utilizo para todos mis proyectos donde hayan bases de datos por en medio. &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Antes de realizar este paso, yo recomendaría instalar el paquete de tools (herramientas) de MySQL llamado MySQL GUI Tools. Nos vienen varios programas muy utiles como el Migrator, para migrar bases de datos, pero el que utilizaremos nosotros es el MySQL Query Browser.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Esta herramienta la usaremos para conectarnos a bases de datos, crearlas y trabajar sobre ellas vaya…&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;También se podría trabajar desde el PHPMyAdmin que viene con WampServer pero su interfaz web deja un poco que desear, al menos para mi gusto. &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Para descargar este paquete tenemos que estar registrados en la pagina de MySQL &lt;/span&gt;&lt;a href=&quot;http://dev.mysql.com/downloads/gui-tools/5.0.html&quot;&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;http://dev.mysql.com/downloads/gui-tools/5.0.html&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;. En este link teneis la pagina de descargas para todas las plataformas, para Windows es este enlace &lt;/span&gt;&lt;a href=&quot;http://dev.mysql.com/get/Downloads/MySQLGUITools/mysql-gui-tools-5.0-r17-win32.msi/from/pick&quot;&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;http://dev.mysql.com/get/Downloads/MySQLGUITools/mysql-gui-tools-5.0-r17-win32.msi/from/pick&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt; y elegís un servidor del cual descargar. &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Una vez descargado lo instalamos, no tiene ninguna complicación. &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Vamos a abrirlo para crear una base de datos con la que trabajaremos en esta y las siguientes entradas del blog.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Una vez abierto el MySQL Query Browser (a partir de ahora llamado QB para esta entrada) nos pedirá usuario y contraseña: &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1mCVrJEnnGso1Mnp6KI8vIMnGU0Y0ACHGLMQXBzKoHW8rqJ3zjoY29GCPaYLlYWkczVGk-RKksl_y_Etwd1Ju_Q7HExle7UMX8I5MZZwFzXvQBgxkX5YVwyCBY8Co7dW0U94SWQ2AwqL_/s1600-h/login.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1mCVrJEnnGso1Mnp6KI8vIMnGU0Y0ACHGLMQXBzKoHW8rqJ3zjoY29GCPaYLlYWkczVGk-RKksl_y_Etwd1Ju_Q7HExle7UMX8I5MZZwFzXvQBgxkX5YVwyCBY8Co7dW0U94SWQ2AwqL_/s320/login.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Para crearnos un usuario tenemos que abrir nuestro navegador y entrar en &lt;/span&gt;&lt;a href=&quot;http://localhost/phpmyadmin&quot;&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;http://localhost/phpmyadmin&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt; y una vez dentro vamos a privilegios para crearnos nuestro usuario : &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzXkTwHcnMDOn9ty-RKEODQpL8hdVTNMFPmzqV1Df5zqnWUBS1W95cB-D6cBkEgCizSv8KocWlmlvZIiabu8gIx1KZvo8_xjJZroljskm6ngIgbjRiYMsn2Bg93G_82Nae-_ACRjBMEshj/s1600-h/phpmyadmin.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;212&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzXkTwHcnMDOn9ty-RKEODQpL8hdVTNMFPmzqV1Df5zqnWUBS1W95cB-D6cBkEgCizSv8KocWlmlvZIiabu8gIx1KZvo8_xjJZroljskm6ngIgbjRiYMsn2Bg93G_82Nae-_ACRjBMEshj/s640/phpmyadmin.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Una vez creado nos logueamos en el QB con nuestro usuario recién creado. En la caja de texto de Default Schema podemos poner la base de datos que queremos que nos abra por defecto. Como al principio no tendremos ninguna pues lo dejamos en blanco.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Una vez dentro he creado una base de datos sencilla llamada “basedatosprueba” con 2 tablas , “Team” y “Player”. Para no complicaros pongo el script para crearla lo mas rápido posible: &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Pegamos este código en nuestra ventana: &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;CREATE DATABASE `basedatosprueba`;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;CREATE TABLE  `basedatosprueba`.`team` (&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;`Team_id` int(10) unsigned NOT NULL AUTO_INCREMENT,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;`Team_name` varchar(45) NOT NULL,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;PRIMARY KEY (`Team_id`)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;) ENGINE=InnoDB DEFAULT CHARSET=latin1;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;CREATE TABLE  `basedatosprueba`.`player` (&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;`Player_id` int(10) unsigned NOT NULL AUTO_INCREMENT,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;`Player_name` varchar(45) NOT NULL,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;`Team_id` int(10) unsigned NOT NULL,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;PRIMARY KEY (`Player_id`),&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;KEY `FK_player_1` (`Team_id`),&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;CONSTRAINT `FK_player_1` FOREIGN KEY (`Team_id`) REFERENCES `team` (`Team_id`)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;) ENGINE=InnoDB DEFAULT CHARSET=latin1;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Y tenemos que ejecutarlo de siguiente manera : &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgi-v17NrpHWWGIKlXQ-wzjvX9Vue1cw9DIlad2K5oBeXR5KFvvGWsFEBqvwo5eg0JNM1TKekRxXyxzVOWTxNWqLKmaiDHt2ZCb2saWOoZN8BaqrK29cVwoSd-hmEGxfgqRwdM-6SxF0lI0/s1600-h/qb1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgi-v17NrpHWWGIKlXQ-wzjvX9Vue1cw9DIlad2K5oBeXR5KFvvGWsFEBqvwo5eg0JNM1TKekRxXyxzVOWTxNWqLKmaiDHt2ZCb2saWOoZN8BaqrK29cVwoSd-hmEGxfgqRwdM-6SxF0lI0/s400/qb1.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Hacemos click donde nos señala la flecha para que esa dicha línea de código coja el foco, y seguidamente pulsamos Control+Enter. &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihTrQutXpeBXGL-x8UGimSqnIYAOPOJcvN-2025UFkbk79dSZnQWs7imvxFwpGLRVlFFc95ipt_JdFIqBvswAIp1_FDV-JqmWV7KKlhLylX3sjgYQyjmDXVE-CN8sjdxG8TSgOSBDeT-Ct/s1600-h/qb2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;232&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihTrQutXpeBXGL-x8UGimSqnIYAOPOJcvN-2025UFkbk79dSZnQWs7imvxFwpGLRVlFFc95ipt_JdFIqBvswAIp1_FDV-JqmWV7KKlhLylX3sjgYQyjmDXVE-CN8sjdxG8TSgOSBDeT-Ct/s400/qb2.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Seleccionamos el siguiente trozo de código haciendo click donde indica la flecha como en el paso anterior y hacemos Control+Enter.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfYFHcPxPN7qHT26pM6lk-k5kftVE-WOxmSiOL0XcMtLqO02uXw926cA1esoDGKyXFOZP92oCmjtwz_UdqLQoBr9vmmP71OOqY7SD-hvLp66qiQsXHauXhNBcNv0BXbAlhPuIf-6nflYNO/s1600-h/qb3.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;228&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfYFHcPxPN7qHT26pM6lk-k5kftVE-WOxmSiOL0XcMtLqO02uXw926cA1esoDGKyXFOZP92oCmjtwz_UdqLQoBr9vmmP71OOqY7SD-hvLp66qiQsXHauXhNBcNv0BXbAlhPuIf-6nflYNO/s400/qb3.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Lo mismo para este trozo de código. &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Nota : fijaros en el sombreado que coge la parte no seleccionada.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Vamos a insertar algunos registros : &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;insert into team (Team_id,Team_name) values (1,&#39;F.C.Barcelona&#39;);&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4pwmZhbXNguAEvbVqzir4BmTsZHJE4n4E545YgBXK0RwPKNH4AB1umj-DDcsmgfRF1vxhG0BaEKBO9J7tmXcHDMYntkSow0Mmj4DToYl5Qx5oGZfc2Bf1OcPT2conF3izPF85_J5gob3y/s1600-h/inserts1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;118&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4pwmZhbXNguAEvbVqzir4BmTsZHJE4n4E545YgBXK0RwPKNH4AB1umj-DDcsmgfRF1vxhG0BaEKBO9J7tmXcHDMYntkSow0Mmj4DToYl5Qx5oGZfc2Bf1OcPT2conF3izPF85_J5gob3y/s400/inserts1.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Y hacemos Control+Enter. &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;insert into player (Player_id,Player_name,Team_id) values (1,&#39;Leo Messi&#39;,1);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Control+Enter otra vez.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpB13fT1Q-u9lTQp-6BCaRp9xFD0oQdRL6SRY05SdZRMeGri1-YgFXTZMYB67DS3fKpdqfuDgz7d1NUniSvL4EMmUAY-gvVRcCxDdV8nqDoxJgKmj68zytf0tpaljAfGkvN5DSBJG3sJbs/s1600-h/inserts2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;93&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpB13fT1Q-u9lTQp-6BCaRp9xFD0oQdRL6SRY05SdZRMeGri1-YgFXTZMYB67DS3fKpdqfuDgz7d1NUniSvL4EMmUAY-gvVRcCxDdV8nqDoxJgKmj68zytf0tpaljAfGkvN5DSBJG3sJbs/s400/inserts2.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;OK, ya tenemos 1 registro en cada tabla, ya podemos irnos a NetBeans y abrir nuestro proyecto que creamos en la anterior entrada, ya que ya lo tenemos preparado con el driver configurado. &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Hasta aquí la segunda entrada, esta misma semana subiré la siguiente, donde ya trabajaremos con NetBeans y veremos la esperada clase DATA.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Hasta la proxima !!&amp;nbsp;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://programadoresconfuturo.blogspot.com/feeds/2827930655995387379/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://programadoresconfuturo.blogspot.com/2010/01/conectar-java-con-mysql-parte-2.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7897005543381843758/posts/default/2827930655995387379'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7897005543381843758/posts/default/2827930655995387379'/><link rel='alternate' type='text/html' href='http://programadoresconfuturo.blogspot.com/2010/01/conectar-java-con-mysql-parte-2.html' title='Conectar JAVA con MySQL (parte 2) : Preparando MySQL'/><author><name>k0balt0</name><uri>http://www.blogger.com/profile/16776937486057958916</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiy91BpX1hICZzMF6jy1cRlKRVUmk1GT33_Vyb6AcJ9XxV7Qdl1elgadV23I3tMSQWuMv-pmrMyOqJsY5JvB48JwW3T-Jch3MGnbXjrwLSdX0O1ba4xk35MUF8kNuqDQA/s220/IMGP2129.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1mCVrJEnnGso1Mnp6KI8vIMnGU0Y0ACHGLMQXBzKoHW8rqJ3zjoY29GCPaYLlYWkczVGk-RKksl_y_Etwd1Ju_Q7HExle7UMX8I5MZZwFzXvQBgxkX5YVwyCBY8Co7dW0U94SWQ2AwqL_/s72-c/login.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7897005543381843758.post-7130284242176250888</id><published>2009-12-21T23:37:00.008+01:00</published><updated>2010-01-27T19:41:18.460+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="base de datos"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><title type='text'>Conectar JAVA con MySQL (parte 1)</title><content type='html'>&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Para poder vincular nuestro entorno de programación, en este caso Netbeans, primero tendremos que configurar nuestra conexión a la base de datos, en este caso trabajaremos con mySQL.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;1-     El primer paso es descargarse el driver que hará de conexión puente de java hacia mysql.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Este lo descargaremos de la pagina de mySQL http://dev.mysql.com/downloads/connector/j/(hay que registrarse) o podemos buscar en cualquier buscador “mysql javaconnector”. La última versión del driver es la 5.1.10.  &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Descargamos el zip con el driver, y dentro de este tendremos varias carpetascon la documentación de este driver. El archivo que realmente necesitamos es el“mysql-connector-java-5.1.10-bin.jar”.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;2-     Vamos a abrir Netbeans y vamos a ver como preparamos el entorno y acoplamos el driver.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Una vez abierto, nos vamos al Menú “Archivo” y clicamos en “Nuevo Proyecto”.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;El siguiente paso es seleccionar “Java Application”, clicamos siguiente.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTFr7q-WQvH8yYhpD937AsqohrmmtbcW01O7oOIs0H4IOszIW7D9UzW366GOC4IPBll7TIQBBuAwvTDFJngmOslp16iCSCQAKwl4N3afiA2jFWEDKJI148nQzZu9uBxd5_Zdyt7PmY4bKI/s1600-h/imagen5.jpg&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5417823487246766658&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTFr7q-WQvH8yYhpD937AsqohrmmtbcW01O7oOIs0H4IOszIW7D9UzW366GOC4IPBll7TIQBBuAwvTDFJngmOslp16iCSCQAKwl4N3afiA2jFWEDKJI148nQzZu9uBxd5_Zdyt7PmY4bKI/s320/imagen5.jpg&quot; style=&quot;cursor: hand; cursor: pointer; display: block; height: 279px; margin: 0px auto 10px; text-align: center; width: 400px;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Configuramos el nombre y la ubicación del proyecto y clicamos en “Terminar”.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXQaZWQCvUXji7I4F772R2f00QWbKXE56Cl6g8deeDSlaThGVFo-ATioGGyfgpwoSDw4XZ380c7HzHjRb-PucwL5Hwi66OFWp-X57_IMqUuY3d0rkJsrtnY3iBv4UW5nCht5kfmLyQbksQ/s1600-h/imagen4.jpg&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5417823483841278482&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXQaZWQCvUXji7I4F772R2f00QWbKXE56Cl6g8deeDSlaThGVFo-ATioGGyfgpwoSDw4XZ380c7HzHjRb-PucwL5Hwi66OFWp-X57_IMqUuY3d0rkJsrtnY3iBv4UW5nCht5kfmLyQbksQ/s320/imagen4.jpg&quot; style=&quot;cursor: hand; cursor: pointer; display: block; height: 279px; margin: 0px auto 10px; text-align: center; width: 400px;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;3-     Ahora copiaremos el archivo “mysql-connector-java-5.1.10-bin.jar”a la carpeta raíz del proyecto que hemos creado. Debería quedarnos así:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjETdoU68k7G_TWei6-69FWkNsP62Gm6IBsXjjOJpA4pDviMKEXJA77eRi6fU6F42_Xvxh_Tn-5pZJro9c8c0aLyeOlMv2UK4fAFGFH7XLW5pFPIORYOvkhzrvq4Amw7jLH1VsWedfhzQqn/s1600-h/imagen3.jpg&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5417823478113774258&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjETdoU68k7G_TWei6-69FWkNsP62Gm6IBsXjjOJpA4pDviMKEXJA77eRi6fU6F42_Xvxh_Tn-5pZJro9c8c0aLyeOlMv2UK4fAFGFH7XLW5pFPIORYOvkhzrvq4Amw7jLH1VsWedfhzQqn/s320/imagen3.jpg&quot; style=&quot;cursor: hand; cursor: pointer; display: block; height: 279px; margin: 0px auto 10px; text-align: center; width: 400px;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;4-     Nos vamos al panel de Proyectos y en la carpeta “Bibliotecas”hacemos click derecho y seleccionamos “Agregar archivo JAR/Carpeta”.Seleccionamos el “mysql-connector-java-5.1.10-bin.jar” y clicamos en “Abrir”.  Ya tenemos el driver incorporado.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimtSwatRnkTEZllImRFHM6BrovjgEPTQ6P9C8yg9jwsiybqRwPWwVdxGYIeEekPb6xY5lJRUtqjlX_CnMjy3edx6xt9vVJByKwRst2_Z0Z5BS68UGhZA5fXk7LyFpVW1ECndsDVH5fbMGy/s1600-h/imagen2.jpg&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5417823472988551474&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimtSwatRnkTEZllImRFHM6BrovjgEPTQ6P9C8yg9jwsiybqRwPWwVdxGYIeEekPb6xY5lJRUtqjlX_CnMjy3edx6xt9vVJByKwRst2_Z0Z5BS68UGhZA5fXk7LyFpVW1ECndsDVH5fbMGy/s320/imagen2.jpg&quot; style=&quot;cursor: hand; cursor: pointer; display: block; height: 279px; margin: 0px auto 10px; text-align: center; width: 400px;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiGlT79WvxMnmIl4EdWSiVyuuzL4GR0ROfNZAcG7VjDpeRujuzyrVAmpCl7rUMCBhJAQXsdrsGjCEdfhggHVZeQH_fu7KAfwr4vpkha2weuz9ol1t3E5Lj8Q3VRdAZieHSZfjLybY5wwuI/s1600-h/imagen1.jpg&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5417823470903996738&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiGlT79WvxMnmIl4EdWSiVyuuzL4GR0ROfNZAcG7VjDpeRujuzyrVAmpCl7rUMCBhJAQXsdrsGjCEdfhggHVZeQH_fu7KAfwr4vpkha2weuz9ol1t3E5Lj8Q3VRdAZieHSZfjLybY5wwuI/s320/imagen1.jpg&quot; style=&quot;cursor: hand; cursor: pointer; display: block; height: 279px; margin: 0px auto 10px; text-align: center; width: 400px;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;En la siguiente entrega veremos cómo acceder a esta base de datos configurando una cadena de conexión (connection string).&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://programadoresconfuturo.blogspot.com/feeds/7130284242176250888/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://programadoresconfuturo.blogspot.com/2009/12/conectar-java-con-mysql-parte-1.html#comment-form' title='3 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7897005543381843758/posts/default/7130284242176250888'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7897005543381843758/posts/default/7130284242176250888'/><link rel='alternate' type='text/html' href='http://programadoresconfuturo.blogspot.com/2009/12/conectar-java-con-mysql-parte-1.html' title='Conectar JAVA con MySQL (parte 1)'/><author><name>k0balt0</name><uri>http://www.blogger.com/profile/16776937486057958916</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiy91BpX1hICZzMF6jy1cRlKRVUmk1GT33_Vyb6AcJ9XxV7Qdl1elgadV23I3tMSQWuMv-pmrMyOqJsY5JvB48JwW3T-Jch3MGnbXjrwLSdX0O1ba4xk35MUF8kNuqDQA/s220/IMGP2129.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTFr7q-WQvH8yYhpD937AsqohrmmtbcW01O7oOIs0H4IOszIW7D9UzW366GOC4IPBll7TIQBBuAwvTDFJngmOslp16iCSCQAKwl4N3afiA2jFWEDKJI148nQzZu9uBxd5_Zdyt7PmY4bKI/s72-c/imagen5.jpg" height="72" width="72"/><thr:total>3</thr:total></entry></feed>