Sie sind auf Seite 1von 51

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

FORMATO DE TRABAJO FINAL


I.

PORTADA
UNIVERSIDAD TCNICA DE AMBATO
Facultad de Ingeniera en Sistemas, Electrnica e Industrial
Proyecto Acadmico de Fin de Semestre
Ttulo:
Creacin de una base de datos
Carrera:
Ingeniera Industrial en Procesos de
Automatizacin
rea Acadmica:
Informtica
Lnea de Investigacin:
Administracin
Ciclo Acadmico y paralelo:
Tercero Industrial B
Alumnos participantes:
Herrera Guayaquil Vicente David
Villagmez Garca Dennis Daniel

Mdulo y Docente:
II.

Nombre del Mdulo Ing. Mg. Nogales Rubn

INFORME DEL PROYECTO


1.
2.

PP
YY

2.1 Ttulo
Creacin de una base de datos y consulta de tablas
2.2 Objetivos
2.2.1 General
Crear una base de datos que represente la facilidad de manipulacin de
informacin que stas brindan teniendo una buena estructura.
2.2.2 Especficos
Disear correctamente el modelo de la base de datos necesaria para el
sistema, definiendo sus restricciones y relaciones, en MySQL Workbench
6.3 CE.
Establecer la conexin a la Base phpMyAdmin con direccin
172.21.123.65/phpMyAdmin.
Realizar la ventana de consulta de datos en NetBeans.
2.3 Resumen
En el presente proyecto, se detalla la creacin de un modelo de base de datos en
MySQL Workbench, siendo este el Sistema Gestionador de Base de Datos
utilizado en el mdulo en curso. Dicha base contiene una simulacin de la gestin
de datos manejada en la Facultad, involucrando las carreras, personas en general,
cargos, y datos de la facultad.
Adems se da a conocer los procesos estndar de normalizacin de bases de
datos para evitar problemas y optimizar espacios, siendo as un paso importante
para la obtencin de un base de datos funcional.
El espacio fsico ha sido creado en phpMyAdmin, siendo este otorgado por el
docente exclusivamente para cada estudiante, al cual se tiene acceso por medio
de la red FISEI nicamente en su espacio de cobertura.
Las ventanas de consultas han sido creadas en NetBeans, ya que es el entorno de
desarrollo integrado libre que se ha estudiado en cursos anteriores.

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

2.4 Palabras clave: (Normalizacin, modelo de datos, tipo de datos)


2.5 Introduccin
El mdulo de Base de Datos, de la Facultad de Ingeniera en Sistemas, Electrnica
e Industrial, de la Universidad Tcnica de Ambato, se muestra con un amplio y
consistente plan de estudios. El cual tiene como objetivo dar a los estudiantes las
nociones esenciales para la creacin de bases de datos efectivas y funcionales,
haciendo uso de los conocimientos previos de Programacin I y Programacin II.
En la actualidad, las bases de datos son el elemento fundamental en toda rea que
utiliza sistemas computarizados; debido a que permite operar informacin de
manera organizada, segura, muy confiable y en grandes cantidades.
Las bases de datos facilitan no solo el registro de gran cantidad de datos, sino,
tambin el acceso a los mismos, lo cual permite ahorrar tanto espacio fsico como
tiempo al momento de consultar informacin contenida en ellas. Reemplazando a
los conocidos, Arturitos. A nivel organizacional, las bases de datos resultan una
ventaja competitiva, siendo as una herramienta primordial al momento de tomar
decisiones
En el presente documento se muestra una base de datos, modelada de acuerdo al
sistema que se maneja en la Facultad de Ingeniera en Sistemas, Electrnica e
Industrial, de la Universidad Tcnica de Ambato.
El modelo inicial de base de datos se maneja en MySQL Workbench 6.3 CE. A

partir del cual se realiza una conexin a base, y la codificacin adecuada


para consultas de datos.
2.6 Materiales y Metodologa
SGBD
Un Sistema de Gestin de Bases de Datos (SGBD) consiste en una coleccin de
datos interrelacionados, con varios programas para acceder a los mismos
Un SGBD permite el almacenamiento, manipulacin y consulta de datos
pertenecientes a una base de datos organizada en ficheros en un espacio fsico.
El SGBD permite:

El mtodo de almacenamiento y el programa que gestiona los datos son


independientes del programa desde el que se realizan las consultas.

Permite consultas complejas cuya resolucin est optimizada y expresadas


mediante un lenguaje formal.

El almacenamiento de los datos se hace de forma eficiente aunque oculta


para el usuario y normalmente tiene, al contrario de lo que ocurre con las
hojas de clculo, poco que ver con la estructura con la que los datos se
presentan al usuario.

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

El acceso concurrente de mltiples usuarios autorizados a los datos,


realizando operaciones de actualizacin y consulta de los mismos
garantizando la ausencia de problemas de seguridad (debidos a accesos
no autorizados) o integridad (prdida de datos por el intento de varios
usuarios de acceder al mismo fichero al mismo tiempo.

BASES DE DATOS RELACIONALES


Es el modelo ms utilizado hoy en da. Una base de datos relacional es
bsicamente un conjunto de tablas, formadas por filas (registros) y columnas
(campos). Los registros representan cada uno de los objetos descritos en la tabla y
los campos representan los atributos (variables de cualquier tipo) de los objetos.
En el modelo relacional de base de datos, las tablas comparten algn campo entre
ellas. Estos campos compartidos van a servir para establecer relaciones entre las
tablas que permitan consultas complejas.
Las tablas comparten algn campo entre ellas, estos campos compartidos van a
servir para establecer relaciones entre las tablas. Los atributos pueden ser de unos
pocos tipos simples:
Nmeros enteros
Nmeros reales
Cadena de caracteres de longitud variable
Estos tipos simples se denominan tipos atmicos y permiten una mayor eficacia en
el manejo de la base de datos pero a costa de reducir la flexibilidad a la hora de
manejar los elementos complejos del mundo real y dificultar la gestin de datos
espaciales, en general suponen un problema para cualquier tipo de datos
geomtricos.
Las relaciones que se establecen entre los diferentes elementos de dos tablas en
una base de datos relacional pueden ser de tres tipos distintos:
1. Relaciones uno a uno, se establecen entre una entidad de una tabla y otra
entidad de otra tabla. Un ejemplo aparece en la figura.
2. Relaciones uno a varios, se establecen entre varias entidades de una tabla
y una entidad de otra tabla. Un ejemplo sera una tabla de pluvimetros en
la que se indicara el municipio en el que se encuentra. La relacin sera
entre un municipio y varios pluvimetros
3. Relaciones varios a varios, se establecen entre varias entidades de cada
una de las tablas. Un ejemplo sera una tabla con retenes de bomberos y
otra con espacios naturales a los que cada uno debe acudir en caso de
incendio.
NORMALIZACIN
Normalizacin es el proceso de organizacin de los datos en una base de datos.
Trata de la creacin de tablas y el establecimiento de relaciones entre ellas segn
reglas diseadas tanto para proteger los datos como para que la base de datos
sea ms flexible mediante la eliminacin de redundancias y dependencias
incoherentes. Es necesario conocer la definicin de dependencia incoherente, lo
cual se puede facilitar con la descripcin de un ejemplo prctico. Aunque es
intuitivo para el usuario buscar en la tabla Customers la direccin de un cliente en
particular, no es prctico buscar all el salario del empleado que atiende a dicho
cliente. El salario de aquel empleado, aunque est relacionado con el cliente, no es
conveniente ubicarlo en la misma tabla, por tanto, se debe mover a una tabla de

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

Empleados solamente. Las dependencias incoherentes pueden dificultar los datos


Access, ya que estos puede ser la ruta de acceso para encontrar los datos
faltantes. Existen reglas para la normalizacin de la base de datos. Cada una de
estas reglas se denomina forma normal. En la primera regla se dice que la base de
datos est en primera forma normal. En las tres primeras reglas se considera que
la base de datos est en la tercera forma normal. Aunque son posibles otros
niveles de normalizacin, la tercera forma normal se considera el mximo nivel
necesario para la mayora de las aplicaciones. Pero como sucede con muchas
reglas y especificaciones formales, las situaciones del mundo real no siempre
permiten cumplir a la perfeccin. La normalizacin requiere tablas adicionales. Si
decide infringir una de las tres primeras reglas de normalizacin, asegrese de que
su aplicacin anticipe cualquier problema que pueda surgir, como datos
redundantes y dependencias incoherentes. [1]
CONTROL DE REDUNDANCIA DE DATOS
Los datos redundantes desperdician espacio en el disco y crean problemas de
mantenimiento. Provoca dificultades en el momento de que si es necesario
cambiar datos que existen en ms de un lugar, se deben cambiar los datos de
igual manera en todas las ubicaciones. Realizar un cambio de direccin de cliente
es mucho ms fcil si los datos se almacenan slo en una tabla clientes y en
ninguna otra en la base de datos. Los sistemas de ficheros almacenan varias
copias de los mismos datos en ficheros distintos. En los sistemas de bases de
datos todos estos ficheros estn integrados, por lo que no se almacenan varias
copias de los mismos datos. Sin embargo, en una base de datos no se puede
eliminar completamente la redundancia de los mismos, ya que en ocasiones es
necesaria para modelar relaciones entre los datos y tener soporte a fallos. [1]
BENEFICIOS
La redundancia de datos en un sistema de almacenamiento proporciona tolerancia
a fallos, lo cual permite que el sistema contine en operacin total o parcial. Si una
parte del sistema falla debido a la prdida o corrupcin de datos. Dicha
redundancia se produce automticamente en algunos conjuntos de los discos,
entonces es posible recuperar datos en caso de fallo del mismo.

ATRIBUTOS CORRESPONDIENTES
Cada elemento en una tabla establecida posee atributos, que son las
caractersticas con las cuales se describe una entidad. Los atributos
correspondientes a dicha entidad la vuelven nica, es decir que sin importar
cuntas entidades haya, cada una es completamente diferente a las dems. En
una estructura de tabla, cada fila representa una entidad y cada columna sus
atributos.

ATRIBUTOS DE TABLAS

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

Cada tabla individual debe ser independiente en cada conjunto de datos que en
ella se relacione, sus atributos deben ser bien ubicados con cada entidad
correspondiente, para lo cual es necesario eliminar grupos repetidos e identificar
cada conjunto de datos relacionado con una clave principal, evitando errores en la
manipulacin de informacin. La definicin de atributos de una tabla debe ser
nica, es decir, no debe haber grupos de repeticin que puedan dar apertura a la
redundancia notable de datos. Es esencial tener en cuenta que una correcta tabla
de datos solo tiene dos dimensiones, que involucran entidades y atributos. [1]
PASOS DE NORMALIZACIN
Primera forma normal
Eliminar grupos repetidos en tablas individuales.
Crear una tabla independiente para cada conjunto de datos relacionados.
Identificar cada conjunto de datos relacionados con una clave principal.
La segunda forma normal
Crear tablas independientes para conjuntos de valores que se apliquen a varios
registros.
Relacione estas tablas con una clave externa.
La tercera forma normal
Elimine los campos que no dependan de la clave.
TIPOS DE DATOS
Despus de la fase de diseo de una base de datos, y una vez se ha realizado el
paso a tablas del mismo, en necesario crear las tablas correspondientes dentro de
la base de datos. Para cada campo de cada una de las tablas, es necesario
determinar el tipo de datos que contiene para de esa forma ajustar el diseo de la
base de datos y conseguir un almacenamiento ptimo con la menor utilizacin de
espacio. MySQL distingue una serie de tipos de datos que podremos utilizar a la
hora de crear los campos que formarn nuestras tablas. [2]
Tipo texto
Char(x)
Tipo de datos que admite caracteres alfanumricos. La longitud de este campo
vara entre 1-255 y est delimitado a la longitud especificada entre parntesis (x)
en el momento de la creacin del campo de la tabla. Al introducir datos en este
campo siempre se solicitar el nmero de caracteres especificados. Si creamos un
campo con Char (5) deberemos introducir cinco caracteres cada vez que
incluyamos un dato en ese campo. Si incluimos menos, mySQL rellenar los
caracteres que faltan hasta el nmero indicado con espacios.
Varchar(x)
Tipo de datos que admite caracteres alfanumricos. Su uso es similar a Char(x). A
la hora de definir un campo de datos Varchar deberemos especificar el nmero
mximo de caracteres que podr aceptar en la entrada de datos, donde x es un
nmero entre 1-255. A diferencia de Char, este tipo de datos es variable en su
longitud, admitiendo entradas inferiores a la establecida.
Text, TintyText, MediumText, LongText
Mediante la declaracin de este tipo de datos se admiten la inclusin de cadenas
alfanumricas "case-insensitive" de longitudes variables. TinyText admite un
mximo de 255 caracteres, Text admite 65.535, MediumText permite introducir
textos de hasta 16.777.215 caracteres, LongText nos ofrece la posibilidad de incluir
un mximo de 4.294.967.295 caracteres. Estos campos no necesitan de
especificaciones de longitud a la hora de ser declarados.

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

Tipo binario
Blob
Un tipo de datos Blob es un objeto binario que puede almacenar cualquier tipo de
datos o informacin, desde un archivo de texto con todo su formato (se diferencia
en esto de tipo Text) hasta imgenes, archivos de sonido o video, etc. Al igual que
el tipo Text, Blob admite hasta 65.535 caracteres.
TinyBlob, MediumBlob, LongBlob
Son datos del mismo tipo que el anterior pero que varan en cuanto a su tamao,
as TinyBlob admite hasta 255 caracteres mximo, MediumBlob acepta tamaos
de hasta 16.777.215 de caracteres y LongBlob 4.294.967.295 caracteres (como
vemos estos tamaos se corresponden con los de TinyText, MediumText y
LongText).
Tipo numrico
Int
Este es un tipo de datos numricos de tipo entero. Este tipo de datos guarda
valores enteros (no decimales) entre -2.147.483.648 y 2.147.483.647. TinyiInt,
SmallInt, MediumInt, BigInt Son tipos de datos numricos enteros (no decimal).
TinyiInt agrupa un rango de nmeros entre -128 y 127. SmallInt alcanza desde
-32.768 hasta 32.767. MediumInt tiene un rango comprendido entre -8.388.608 y
8.388.607. Finalmente el tipo de datos BigInt ocupa un rango numrico entre
-9.223.372.036.854.775.808 hasta 9.223.372.036.854.775.807.
Float (M, D)
Nmero de coma flotante de precisin simple. El valor del argumento M nos indica
el nmero de dgitos decimales que se van a utilizar para representar el nmero.
As, un valor de 5 nos permitir representar nmeros comprendidos entre -99 y 99
(Nmeros expresados en binario con 5 dgitos y signo). El valor del argumento D
nos indica el nmero de posiciones decimales que se van a utilizar en la
representacin del nmero. As, una representacin tipo Float (5,2) nos permitir
incluir nmeros entre -99,99 y 99,99. El rango de los nmeros de coma flotante de
precisin simple es de -3,402823466E+38 a -1,175494351E-38, 0, y
1,175494351E- 38 hasta 3,402823466E+38.
Double (M, D)
Nmero de coma flotante de precisin doble. Es un tipo de datos igual al anterior
cuya nica diferencia es el rango numrico que abraca, siendo este el
comprendido entre 1,7976931348623157E+308 hasta -2,.2250738585072014E308, 0, y 2,2250738585072014E-308 to 1,7976931348623157E+308
Decimal (M, D)
Su uso es similar al de los anteriores, pero, en este caso, D puede tener valor 0. El
rango de este nmero es el mismo que el de nmero con coma flotante de
precisin doble.
Tipo fecha- hora
Date
Formato de Fecha. Su representacin es en formato de fecha numrica del tipo
'YYYY-MM-DD' (Ao con cuatro dgitos, Mes con dos dgitos, da con dos dgitos).
Su rango es '1000-01-01' (1 de enero del ao 1000, en el cual yo era an muy
pequeo) hasta '9999-12-31' (31 de diciembre del 9999, que ya veremos qu pasa
despus de las uvas).

Date Time

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

Es una combinacin de formato de fecha y hora conjuntamente. Su representacin


es 'YYYY-MM-DD HH:MM:SS' (Ao con cuatro dgitos, Mes con dos dgitos, da
con dos dgitos, hora con dos dgitos, minutos con dos dgitos, segundos con dos
dgitos). El rango que soporta este formato es de '1000-01-01 00:00:00' (las 00
horas, 00 minutos, 00 segundos del 1 de enero del ao 1000, que no se yo con
que reloj podan medir esto) hasta '9999-12-31 23:59:59' (las 23 horas, 59 minutos,
59 segundos del 31 de diciembre del ao 9999, es decir, justo antes de las
campanadas y una vez que han acabado los cuartos).
TimeStamp(N)
Este es un tipo de datos muy particular. Necesita de un argumento N que puede
ser uno de estos nmeros; 14, 12, 10, 8, 6, 4, 2. N representa el nmero de dgitos
que se utilizarn para representar un valor de fecha y hora comprendido desde el
inicio del ao 1970 hasta algn momento del ao 2037. As:
TimeStamp (14): YYYYMMDDHHMMSS (Ao 4 dgitos + mes + da + hora +
minutos + segundos 2 dgitos)
TimeStamp (12): YYMMDDHHMMSS (Ao 2 dgitos + mes + da + hora + minutos
+ segundos 2 dgitos)
TimeStamp (10): YYMMDDHHMM (Ao + mes + da + hora + minutos 2 dgitos)
TimeStamp (8): YYMMDDHH (Ao + mes + da + hora 2 dgitos)
TimeStamp (6): YYMMDD (Ao + mes + da 2 dgitos)
TimeStamp (4): YYMM (Ao + mes 2 dgitos)
TimeStamp (2): YY (Ao 2 dgitos)
PHPMYADMIN
Es una aplicacin muy completa con infinidad de usos y caractersticas, por lo que
en este apartado hablaremos sobre las funciones ms bsicas o ms usadas por
la mayora de usuarios.
La aplicacin nos permite las operaciones bsicas en bases de datos MySQL
cmo pueden ser: crear/eliminar bases de datos, crear/eliminar/alterar tablas,
borrar/editar/aadir campos, ejecutar sentencias SQL, administrar claves en
campos, administrar privilegios y exportar datos en varios formatos. Como
podemos ver la funcionalidad bsica es muy completa, muchas veces la opcin de
exportar datos se emplea para realizar backups de la base de datos y poder
restaurar esta copia de seguridad en el futuro a travs de phpMyAdmin con la
opcin importar.
Es el administrador de bases de datos por defecto en muchos paneles de control
comerciales como pueden ser cPanel, Plesk o DirectAdmin, lo que demuestra la
calidad de este script.
En mi opinin es una herramienta bsica que debera saber manejar cualquier
webmaster, ya sea novato o avanzado.
Otra funcin importante es que permite optimizar y reparar tablas, que son dos
tareas de mantenimiento muy importantes en nuestros proyectos web.
Otra funcionalidad que encuentro muy til es la posibilidad de realizar bsquedas
en las bases de datos as como poder escribir nuestras propias consultas SQL
directamente y ejecutarlas. Tambin es una herramienta de gran ayuda para
desarrolladores de aplicaciones que empleen MySQL ya que permite depurar
consultas y hacer tests de forma rpida y sencilla. [3]
LIBRERAS Y CONEXIN A BASE
Antes que todo, se debe sealar que los paquetes de clases involucrados dentro
de una aplicacin con stas caractersticas son java.sql y javax.sql.

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

Lo primero que se debe realizar para poder conectarse a una base de datos es
cargar el driver encargado de sta funcin. Para ello es utilizada la
llamada Class.forName.
Class.forName ("DriverXYZ");
Donde DriverXYZ corresponde al driver a cargar, por ejemplo, el driver JDBCODBC
es sun.jdbc.odbc.JdbcOdbcDriver;
el
driver
JDBC-MySQL
es com.mysql.jdbc.Driver.
Una vez cargado el driver es necesario crear un objeto del tipo Connection, para
administrar la conexin. Una aplicacin puede utilizar DriverManager para obtener
un objeto de tipo conexin, Connection, con una base de datos. La conexin se
especifica siguiendo una sintaxis basada en la especificacin ms amplia de los
URL, de la forma:
Jdbc: subprotocolo//servidor: puerto/base de datos
La siguiente lnea de cdigo ilustra sta idea:
Connection con = DriverManager.getConnection (url, "myLogin", "myPassword");
Si uno de los drivers que hemos cargado reconoce la URL suministrada por el
mtodo DriverManager.getConnection, dicho driver establecer una conexin con
el controlador de base de datos especificado en la URL del JDBC. La
claseDriverManager, como su nombre indica, maneja todos los detalles del
establecimiento de la conexin detrs de la escena. A menos que estemos
escribiendo un driver, posiblemente nunca utilizaremos ningn mtodo del interface
Driver.
La conexin devuelta por el mtodo DriverManager.getConnection es una conexin
abierta que se puede utilizar para crear sentencias JDBC que pasen nuestras
sentencias SQL al controlador de la base de datos.
Todas las operaciones que se realizan al administrar una base de datos se pueden
clasificar en dos categoras generales: Actualizaciones y Consultas. Dentro de las
Actualizaciones se encuentran todo lo relacionado con la modificacin de
entidades (tablas), como por ejemplo, "crear entidad", "modificar atributos",
"eliminar registro", etc. En cambio, dentro de las Consultas se encuentran todas las
consultas que se puedan realizar a la base de datos, por ejemplo: "Seleccionar un
registro de tal entidad", etc.
El objeto que se encarga de enviar las sentencias SQL al driver es el Statement. Al
objeto Statement se le debe indicar que mtodo de utilizar dependiendo del tipo de
sentencia SQL enviada (Actualizaciones o Consultas). Si la sentencia SQL es una
Actualizacin, entonces se utiliza el mtodo executeUpdate. Si la sentencia SQL es
una Consulta, entonces se utiliza el mtodo executeQuery.
Para crear el objeto Statement se debe invocar el mtodo createStatement dentro
del objeto del tipo Connection utilizado para conectarse a la base de datos.
La lnea de cdigo siguiente muestra cmo crear un objeto Statement
(donde con es un objeto del tipo Connection).
Statement stmt = con.createStatement ();
La lnea de cdigo siguiente muestra el objeto Statement ejecutando una sentencia
SQL para crear una tabla. [4]
TABLAS CREADAS EN MySQL
Facultad
IdFACULTAD
Nombre
Direccin
Telfono
Pgina
Siglas
Calificacin

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD
DE INGENIERA EN SISTEMAS, ELECTRNICA
Carrera
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016
IdCarrera
Nombre
Aos
Facultad_idFACULTAD
Estudiante_idEstudiant
es
Malla
Curricular

idMalla Curricular
Nombre
Crditos
Correquisitos
Niveles
Prerrequisitos
idNiveles
Carrera_idCarrera
Comisiones
Nombre
Carrera_Facultad_idFACU
idComisiones
Malla
LTAD Curricular_idMalla Curricular
Nombre
Malla
Curricular_Carrera_idCarrera
Descripcin Personal
Malla
idAdministrativo
Carrera_idCarrera
Curricular_Carrera_Facultad_idFACULTAD
Nombre
Carrera_Facultad_idFACU
Estudiant Domicilio
LTAD
Dependencia
e
Telfono
idCargos
idEstudiant Correo Electrnico
Nombre
Administrativocol
es
Ubicacin
Periodo de Labores
Nombre
Personal_has_Dependenc
Direccin Titulacin
ia
Aos de Experiencia
Telfono
Personal_idAdministrativo
Estado Civil
Email
Dependecia_idCargos
EstudiantecPersonalcol
Carrera_idCarrera
ol
2.7
Resultados y Discusin
Carrera_Facultad_idFACULTA
El
modelo
de
datos
creado
en
D
WorkBench, fue analizado con las
Carrera_Estudiante_idEstudi
reglas
de normalizacin de bases de datos.
Como
ya se conoce, para eliminar la
antes
redundancia, posibles errores y
optimizar espacio en el disco.
El espacio fsico de la base de datos fue creado en PhpMyAdmin, con la IP
otorgada por el docente director de proyecto a cada alumno con su propio usuario
y contrasea, se realiz la conexin por medio de la red FISEI de la facultad.
El cdigo creado en lenguaje JAVA por medio de NetBeans, permite una
visualizacin de los datos insertados en la Base, permitiendo consultas
personalizadas y generales.
2.8 Conclusiones
El modelo de base de datos realizado para el proyecto es una ejecucin en
funcin de la estructura estudiantil que lleva la Facultad de Ingeniera en
Sistemas, Electrnica e Industrial de la Universidad Tcnica de Ambato.
Tomando en cuenta que es un sistema que involucra relaciones unomuchos, muchos-uno muchos-muchos, por las relaciones que existen entre
materias, carreras, docentes, alumnos y autoridades, la normalizacin de la
base de datos es esencial para garantizar su correcto funcionamiento.
El espacio fsico de la base de datos fue creado y otorgado por el docente a
cada alumno con su propio usuario y contrasea. La direccin de la base
establecida es 172.21.123.65/phpMyAdmin. Siendo esta realizada por
medio de la red FISEI para poder acceder inalmbricamente desde
cualquier lugar dentro de la facultad.
La ventana de consultas realizada en NetBeans posee un cdigo otorgado
en un botn que se encarga verificar la conexin con la base de datos, en

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

este caso siendo un localhost. De igual forma el cdigo involucra libreras


sumamente importantes para poder trabajar ms fcilmente en clases y
correr el programa sin problemas.
2.9 Referencias bibliogrficas
https://support.microsoft.com/es-es/kb/209534.[1]
http://www.tododebian.es/contenidos/Documentacion/tipos%20de%20datos%2 0en
%20mysql.pdf. [2]
http://www.vozidea.com/phpmyadmin-administrador-bases-de-datos[3]
http://profesores.elo.utfsm.cl/~agv/elo330/2s03/projects/JDBC/jdbc-01.html. [4]
2.10. Fotografas y grficos
Modelo de Datos

Codigo:
AREAS:
ackage conexion;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
/**
*
* @author DavidHerrera
*/
public class AREAS extends javax.swing.JFrame {
public AREAS() {
initComponents();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
codigo = new javax.swing.JTextField();
nombre = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
tele = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setText("AREAS");

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

jLabel2.setText("Codigo");
jLabel3.setText("Nombre");
jLabel4.setText("INGRESE EL CODIGO DE LA CARRERA");
jButton1.setText("Registrar");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout
layout
=
new
javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(67, 67, 67)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.LEADING)
.addComponent(jLabel2)
.addComponent(jLabel3))
.addGap(64, 64, 64)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.TRAILING)
.addComponent(nombre,
javax.swing.GroupLayout.PREFERRED_SIZE,
106,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(codigo,
javax.swing.GroupLayout.PREFERRED_SIZE,
106,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addGap(161, 161, 161)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.LEADING)
.addComponent(jButton1)
.addComponent(tele,
javax.swing.GroupLayout.PREFERRED_SIZE,
108,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addGap(191, 191, 191)
.addComponent(jLabel1))
.addGroup(layout.createSequentialGroup()
.addGap(109, 109, 109)
.addComponent(jLabel4)))
.addContainerGap(54, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

.addGroup(layout.createSequentialGroup()
.addContainerGap(24, Short.MAX_VALUE)
.addComponent(jLabel1)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.BASELINE)
.addComponent(jLabel2)
.addComponent(codigo,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)
.addComponent(nombre,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3))
.addGap(18, 18, 18)
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELA
TED)
.addComponent(tele, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jButton1)
.addGap(27, 27, 27))
);
pack();
}// </editor-fold>
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
test_conect con=new test_conect();
Connection reg= con.conexion();
String cod, nom, cd,tel,mail,dir;
String sql;
cod=codigo.getText();
nom=nombre.getText();
tel=tele.getText();
//INSERT INTO `AREAS`(`idAREAS`, `Nombre`, `CARRERAS_idCARRERAS`)
sql="INSERT
INTO
`AREAS`
(`idAREAS`,
`Nombre`,`CARRERAS_idCARRERAS`)VALUES (?,?,?)";
try {
PreparedStatement pst=reg.prepareStatement(sql);
pst.setString(1,cod);
pst.setString(2,nom);
pst.setString(3,tel);
int n=pst.executeUpdate();
if (n>0){
JOptionPane.showMessageDialog(null,"registrado con exito");
}

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

} catch (SQLException ex) {


Logger.getLogger(AREAS.class.getName()).log(Level.SEVERE, null, ex);
}
}
public static void main(String args[]) {
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code
(optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default
look and feel.
*
For
details
see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(AREAS.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(AREAS.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(AREAS.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(AREAS.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
}
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new AREAS().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JTextField codigo;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JTextField nombre;
private javax.swing.JTextField tele;
// End of variables declaration
}
CARGOS:
package conexion;

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
/**
*
* @author DavidHerrera
*/
public class CARGOS extends javax.swing.JFrame {
public CARGOS() {
initComponents();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
codigo = new javax.swing.JTextField();
nombre = new javax.swing.JTextField();
tele = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setText("CARGOS");
jLabel2.setText("Codigo");
jLabel3.setText("Nombre");
jLabel4.setText("Descripcin");
jButton1.setText("Ingresar");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout
layout
=
new
javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

.addGroup(layout.createSequentialGroup()
.addGap(170, 170, 170)
.addComponent(jLabel1))
.addGroup(layout.createSequentialGroup()
.addGap(86, 86, 86)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.LEADING)
.addComponent(jLabel4)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.
Alignment.TRAILING)
.addComponent(jLabel2)
.addComponent(jLabel3)))
.addGap(47, 47, 47)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.LEADING)
.addComponent(jButton1)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.
Alignment.LEADING, false)
.addComponent(codigo)
.addComponent(nombre)
.addComponent(tele,
javax.swing.GroupLayout.DEFAULT_SIZE, 129, Short.MAX_VALUE)))))
.addContainerGap(69, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(24, 24, 24)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(18, 18, 18)
.addComponent(codigo,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel2))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.BASELINE)
.addComponent(jLabel3)
.addComponent(nombre,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.BASELINE)
.addComponent(jLabel4)
.addComponent(tele, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRE
LATED)
.addComponent(jButton1)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
test_conect con=new test_conect();
Connection reg= con.conexion();
String cod, nom, cd,tel,mail,dir;
String sql;
cod=codigo.getText();
nom=nombre.getText();
tel=tele.getText();
//INSERT INTO `CARGOS`(`idCARGOS`, `Nombre`, `Descripcin`) VALUES
sql="INSERT INTO `CARGOS` (`idCARGOS`, `Nombre`,`Descripcin`)VALUES
(?,?,?)";
try {
PreparedStatement pst=reg.prepareStatement(sql);
pst.setString(1,cod);
pst.setString(2,nom);
pst.setString(3,tel);
int n=pst.executeUpdate();
if (n>0){
JOptionPane.showMessageDialog(null,"registrado con exito");
}
} catch (SQLException ex) {
Logger.getLogger(CARGOS.class.getName()).log(Level.SEVERE, null, ex);
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code
(optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default
look and feel.
*
For
details
see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(CARGOS.class.getName()).log(java.util.l
ogging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(CARGOS.class.getName()).log(java.util.l
ogging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(CARGOS.class.getName()).log(java.util.l
ogging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(CARGOS.class.getName()).log(java.util.l
ogging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new CARGOS().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JTextField codigo;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JTextField nombre;
private javax.swing.JTextField tele;
// End of variables declaration
}
CARRERAS:
package conexion;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
/**
*
* @author DavidHerrera
*/
public class CARRERAS extends javax.swing.JFrame {
public CARRERAS() {
initComponents();
}
@SuppressWarnings("unchecked")

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

// <editor-fold defaultstate="collapsed" desc="Generated Code">


private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
codigo = new javax.swing.JTextField();
nombre = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setText("CARRERAS");
jLabel2.setText("Cdigo");
jLabel3.setText("Nombre");
jButton1.setText("Enviar");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout
layout
=
new
javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(71, 71, 71)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)
.addComponent(jLabel3)
.addComponent(jLabel2))
.addGap(54, 54, 54)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING, false)
.addComponent(jLabel1)
.addComponent(codigo)
.addComponent(nombre, javax.swing.GroupLayout.DEFAULT_SIZE,
113, Short.MAX_VALUE))
.addContainerGap(125, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addComponent(jButton1)
.addGap(83, 83, 83))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

.addGap(30, 30, 30)


.addComponent(jLabel1)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.BASELINE)
.addComponent(jLabel2)
.addComponent(codigo,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(24, 24, 24)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.BASELINE)
.addComponent(jLabel3)
.addComponent(nombre,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(39, 39, 39)
.addComponent(jButton1)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
test_conect con=new test_conect();
Connection reg= con.conexion();
String cod, nom, cd,tel,mail,dir;
String sql;
cod=codigo.getText();
nom=nombre.getText();
//INSERT INTO `CARRERAS`(`idCARRERAS`, `Nombre`) VALUES ([value-1],
[value-2])
sql="INSERT INTO `CARRERAS` (`idCARRERAS`, `Nombre`)VALUES (?,?)";
try {
PreparedStatement pst=reg.prepareStatement(sql);
pst.setString(1,cod);
pst.setString(2,nom);
int n=pst.executeUpdate();
if (n>0){
JOptionPane.showMessageDialog(null,"registrado con exito");
}
} catch (SQLException ex) {
Logger.getLogger(CARRERAS.class.getName()).log(Level.SEVERE, null,
ex);
}
}
public static void main(String args[]) {
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code
(optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default
look and feel.

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

*
For
details
see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(CARRERAS.class.getName()).log(java.ut
il.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(CARRERAS.class.getName()).log(java.ut
il.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(CARRERAS.class.getName()).log(java.ut
il.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(CARRERAS.class.getName()).log(java.ut
il.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new CARRERAS().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JTextField codigo;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JTextField nombre;
// End of variables declaration
}
COMISIONES:
package conexion;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
/**
*
* @author DavidHerrera

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

*/
public class COMISIONES extends javax.swing.JFrame {
/**
* Creates new form COMISIONES
*/
public COMISIONES() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
codigo = new javax.swing.JTextField();
nombre = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setText("COMISIONES");
jLabel2.setText("Codigo");
jLabel3.setText("Nombre");
jButton1.setText("Registrarse");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout
layout
=
new
javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(69, 69, 69)
.addComponent(jLabel1)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.LEADING)
.addComponent(jLabel2)
.addComponent(jLabel3))
.addGap(49, 49, 49)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.LEADING)
.addComponent(codigo)
.addComponent(nombre))))
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addGap(0, 65, Short.MAX_VALUE)
.addComponent(jButton1)
.addGap(62, 62, 62))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(32, 32, 32)
.addComponent(jLabel1)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.BASELINE)
.addComponent(jLabel2)
.addComponent(codigo,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(23, 23, 23)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.BASELINE)
.addComponent(jLabel3)
.addComponent(nombre,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jButton1)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
test_conect con=new test_conect();
Connection reg= con.conexion();
String cod, nom, cd,tel,mail,dir;
String sql;
cod=codigo.getText();
nom=nombre.getText();

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

//INSERT INTO `COMISIONES`(`idCOMISIONES`, `Nombre`) VALUES ([value1],[value-2])


sql="INSERT INTO `COMISIONES` (`idCOMISIONES`, `Nombre`)VALUES
(?,?)";
try {
PreparedStatement pst=reg.prepareStatement(sql);
pst.setString(1,cod);
pst.setString(2,nom);
int n=pst.executeUpdate();
if (n>0){
JOptionPane.showMessageDialog(null,"registrado con exito");
}
} catch (SQLException ex) {
Logger.getLogger(COMISIONES.class.getName()).log(Level.SEVERE, null,
ex);
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code
(optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default
look and feel.
*
For
details
see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(COMISIONES.class.getName()).log(java.
util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(COMISIONES.class.getName()).log(java.
util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(COMISIONES.class.getName()).log(java.
util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(COMISIONES.class.getName()).log(java.
util.logging.Level.SEVERE, null, ex);

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new COMISIONES().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JTextField codigo;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JTextField nombre;
// End of variables declaration
}
ESTABLECER CONEXIN:
package conexion;
import java.sql.Connection;
import javax.swing.JOptionPane;
/**
*
* @author DavidHerrera
*/
public class Establecer_Conexion extends javax.swing.JFrame {
public Establecer_Conexion() {
initComponents();
this.setTitle("BASES DE DATOS DE UNIVERSIDADES");
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jMenuBar2 = new javax.swing.JMenuBar();
jMenu4 = new javax.swing.JMenu();
jMenu5 = new javax.swing.JMenu();
Universidades = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jButton5 = new javax.swing.JButton();
jButton6 = new javax.swing.JButton();
jButton7 = new javax.swing.JButton();
jButton8 = new javax.swing.JButton();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMenuItem2 = new javax.swing.JMenuItem();
jMenu2 = new javax.swing.JMenu();

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

jMenuItem4 = new javax.swing.JMenuItem();


jMenu3 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
jMenu4.setText("File");
jMenuBar2.add(jMenu4);
jMenu5.setText("Edit");
jMenuBar2.add(jMenu5);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
Universidades.setText("Universidades");
Universidades.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
UniversidadesActionPerformed(evt);
}
});
jButton2.setText("Carreras");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton3.setText("Facultades");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jButton4.setText("Areas");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
jButton5.setText("Docentes");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
jButton6.setText("Modulos");
jButton6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
}
});

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

jButton7.setText("Estudiantes");
jButton7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton7ActionPerformed(evt);
}
});
jButton8.setText("Comisiones");
jButton8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton8ActionPerformed(evt);
}
});
jMenu1.setText("Inicio");
jMenuItem2.setText("Salir");
jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem2ActionPerformed(evt);
}
});
jMenu1.add(jMenuItem2);
jMenuBar1.add(jMenu1);
jMenu2.setText("Ingresar");
jMenuItem4.setText("Universidades");
jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem4ActionPerformed(evt);
}
});
jMenu2.add(jMenuItem4);
jMenuBar1.add(jMenu2);
jMenu3.setText("Conexion");
jMenuItem1.setText("Conectar");
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem1ActionPerformed(evt);
}
});
jMenu3.add(jMenuItem1);
jMenuBar1.add(jMenu3);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout
javax.swing.GroupLayout(getContentPane());

layout

new

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(26, 26, 26)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(Universidades)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.U
NRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.TRAILING)
.addComponent(jButton5)
.addComponent(jButton2)))
.addGroup(layout.createSequentialGroup()
.addGap(14, 14, 14)
.addComponent(jButton4)))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(jButton3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.R
ELATED)
.addComponent(jButton8))
.addGroup(layout.createSequentialGroup()
.addComponent(jButton6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.R
ELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton7)))
.addContainerGap(31, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.BASELINE)
.addComponent(Universidades)
.addComponent(jButton2)
.addComponent(jButton3)
.addComponent(jButton8))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.BASELINE)
.addComponent(jButton4)
.addComponent(jButton5)
.addComponent(jButton6)
.addComponent(jButton7))
.addGap(61, 61, 61))
);

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

pack();
}// </editor-fold>
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {
test_conect conec=new test_conect();
Connection con=conec.conexion();
if(con!=null){
JOptionPane.showMessageDialog(null, "conexion establecida");
}
else{
JOptionPane.showMessageDialog(null, "Error conexion");
}
}
private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {
Formulario_Datos fd=new Formulario_Datos();
fd.setVisible(true);
}
private void UniversidadesActionPerformed(java.awt.event.ActionEvent evt) {
Formulario_Datos fd=new Formulario_Datos();
fd.setVisible(true);
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
CARRERAS f2=new CARRERAS();
f2.setVisible(true);
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
FACULTAD f=new FACULTAD();
f.setVisible(true);
// TODO add your handling code here:
}
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
Formulario_Datos fd=new Formulario_Datos();
fd.setVisible(true);
// TODO add your handling code here:
}
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {
Estudiantes f1=new Estudiantes();
f1.setVisible(true);
// TODO add your handling code here:
}
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
AREAS f3=new AREAS();
f3.setVisible(true);
// TODO add your handling code here:
}
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {
Formulario_Datos fd=new Formulario_Datos();
fd.setVisible(true);
// TODO add your handling code here:
}
private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {
COMISIONES f4=new COMISIONES();
f4.setVisible(true);
// TODO add your handling code here:

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

}
private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(WIDTH);
// TODO add your handling code here:
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code
(optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default
look and feel.
*
For
details
see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Establecer_Conexion.class.getName()).l
og(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Establecer_Conexion.class.getName()).l
og(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Establecer_Conexion.class.getName()).l
og(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Establecer_Conexion.class.getName()).l
og(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Establecer_Conexion().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton Universidades;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

private javax.swing.JButton jButton5;


private javax.swing.JButton jButton6;
private javax.swing.JButton jButton7;
private javax.swing.JButton jButton8;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenu jMenu3;
private javax.swing.JMenu jMenu4;
private javax.swing.JMenu jMenu5;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuBar jMenuBar2;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JMenuItem jMenuItem2;
private javax.swing.JMenuItem jMenuItem4;
// End of variables declaration
}
ESTUDIANTES:
package conexion;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
/**
*
* @author DavidHerrera
*/
public class Estudiantes extends javax.swing.JFrame {
public Estudiantes() {
initComponents();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
codigo = new javax.swing.JTextField();
nombre = new javax.swing.JTextField();
direccion = new javax.swing.JTextField();
telefono = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setText("ESTUDIANTES");

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

jLabel2.setText("Codigo");
jLabel3.setText("Nombre");
jLabel4.setText("Direccin");
jLabel5.setText("Telfono");
jButton1.setText("Enviar");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout
layout
=
new
javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(158, 158, 158)
.addComponent(jLabel1)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGap(68, 68, 68)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)
.addComponent(jLabel2)
.addComponent(jLabel3)
.addComponent(jLabel4)
.addComponent(jLabel5))
.addGap(38, 38, 38)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING, false)
.addComponent(codigo)
.addComponent(nombre)
.addComponent(direccion)
.addComponent(telefono, javax.swing.GroupLayout.DEFAULT_SIZE,
119, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELA
TED, 49, Short.MAX_VALUE)
.addComponent(jButton1)
.addGap(20, 20, 20))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.BASELINE)

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

.addComponent(jLabel2)
.addComponent(codigo,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.BASELINE)
.addComponent(jLabel3)
.addComponent(nombre,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.BASELINE)
.addComponent(jLabel4)
.addComponent(direccion,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(23, 23, 23)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.LEADING)
.addComponent(jLabel5)
.addComponent(telefono,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(40, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.R
ELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton1)
.addGap(24, 24, 24))))
);
pack();
}// </editor-fold>
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
test_conect con=new test_conect();
Connection reg= con.conexion();
String cod, nom, cd,tel,mail,cate,dir;
String sql;
cod=codigo.getText();
nom=nombre.getText();
dir=direccion.getText();
tel=telefono.getText();
//INSERT INTO `Estudiantes`(`idEstudiantes`, `Nombre`, `doreccion`, `telefono`)
VALUES ([value-1],[value-2],[value-3],[value-4])

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

sql="INSERT
INTO
`Estudiantes`
(`idEstudiantes`,
`Nombre`,`Doreccion`,`Telefono`)VALUES (?,?,?,?)";
try {
PreparedStatement pst=reg.prepareStatement(sql);
pst.setString(1,cod);
pst.setString(2,nom);
pst.setString(3,dir);
pst.setString(4,tel);
int n=pst.executeUpdate();
if (n>0){
JOptionPane.showMessageDialog(null,"registrado con exito");
}
} catch (SQLException ex) {
Logger.getLogger(Estudiantes.class.getName()).log(Level.SEVERE, null,
ex);
}
}
public static void main(String args[]) {
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code
(optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default
look and feel.
*
For
details
see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Estudiantes.class.getName()).log(java.uti
l.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Estudiantes.class.getName()).log(java.uti
l.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Estudiantes.class.getName()).log(java.uti
l.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Estudiantes.class.getName()).log(java.uti
l.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Estudiantes().setVisible(true);
}
});
}
// Variables declaration - do not modify

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

private javax.swing.JTextField codigo;


private javax.swing.JTextField direccion;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JTextField nombre;
private javax.swing.JTextField telefono;
// End of variables declaration
}
FACULTAD:
package conexion;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
/**
*
* @author DavidHerrera
*/
public class FACULTAD extends javax.swing.JFrame {
public FACULTAD() {
initComponents();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
codigo = new javax.swing.JTextField();
nombre = new javax.swing.JTextField();
direccion = new javax.swing.JTextField();
telefono = new javax.swing.JTextField();
email = new javax.swing.JTextField();
web = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setText("Cogido");
jLabel2.setText("Nombre");

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

jLabel3.setText("Direccin");
jLabel4.setText("Telefono");
jLabel5.setText("Email");
jLabel6.setText("Pagina web");
jLabel7.setText("Facultades");
jButton1.setText("Enviar");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout
layout
=
new
javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(35, 35, 35)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)
.addComponent(jLabel1)
.addComponent(jLabel2)
.addComponent(jLabel3)
.addComponent(jLabel4)
.addComponent(jLabel5)
.addComponent(jLabel6))
.addGap(67, 67, 67)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)
.addComponent(jLabel7)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Align
ment.LEADING, false)
.addComponent(codigo)
.addComponent(nombre)
.addComponent(direccion)
.addComponent(telefono)
.addComponent(email)
.addComponent(web, javax.swing.GroupLayout.DEFAULT_SIZE,
116, Short.MAX_VALUE)))
.addContainerGap(127, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addComponent(jButton1)
.addGap(54, 54, 54))
);

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(24, 24, 24)
.addComponent(jLabel7)
.addGap(31, 31, 31)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.BASELINE)
.addComponent(jLabel1)
.addComponent(codigo,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRE
LATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.BASELINE)
.addComponent(jLabel2)
.addComponent(nombre,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(1, 1, 1)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.BASELINE)
.addComponent(jLabel3)
.addComponent(direccion,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELA
TED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.BASELINE)
.addComponent(jLabel4)
.addComponent(telefono,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELA
TED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.BASELINE)
.addComponent(jLabel5)
.addComponent(email, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELA
TED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.BASELINE)
.addComponent(jLabel6)

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

.addComponent(web, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jButton1)
.addContainerGap(40, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
test_conect con=new test_conect();
Connection reg= con.conexion();
String cod, nom, cd,tel,mail,dir;
String sql;
cod=codigo.getText();
nom=nombre.getText();
dir=direccion.getText();
tel=telefono.getText();
mail=email.getText();
cd=web.getText();
//INSERT INTO `FACULTADES`(`idFACULTADES`, `Nombre`, `Direccin`,
`Telefno`, `E-mail`, `Pagina web`) VALUES ([value-1],[value-2],[value-3],[value-4],
[value-5],[value-6])
sql="INSERT
INTO
`FACULTADES`
(`idFACULTADES`,
`Nombre`,`Direccin`,`Telefno`,`E-mail`,`Pagina web`)VALUES (?,?,?,?,?,?)";
try {
PreparedStatement pst=reg.prepareStatement(sql);
pst.setString(1,cod);
pst.setString(2,nom);
pst.setString(3,dir);
pst.setString(4,tel);
pst.setString(5,mail);
pst.setString(6,cd);
int n=pst.executeUpdate();
if (n>0){
JOptionPane.showMessageDialog(null,"registrado con exito");
}
} catch (SQLException ex) {
Logger.getLogger(FACULTAD.class.getName()).log(Level.SEVERE, null,
ex);
}
}
public static void main(String args[]) {
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code
(optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default
look and feel.
*
For
details
see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FACULTAD.class.getName()).log(java.util
.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FACULTAD.class.getName()).log(java.util
.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FACULTAD.class.getName()).log(java.util
.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FACULTAD.class.getName()).log(java.util
.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new FACULTAD().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JTextField codigo;
private javax.swing.JTextField direccion;
private javax.swing.JTextField email;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JTextField nombre;
private javax.swing.JTextField telefono;
private javax.swing.JTextField web;
// End of variables declaration
}
FORMULARIO DATOS:
package conexion;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

/**
*
* @author DavidHerrera
*/
public class Formulario_Datos extends javax.swing.JFrame {
public Formulario_Datos() {
initComponents();
this.setTitle("Ingreso de Datos Universidades");
mostrardatosunviersidad();
}
void mostrardatosunviersidad(){
test_conect conec=new test_conect();
Connection con=conec.conexion();
DefaultTableModel modelouni=new DefaultTableModel();
modelouni.addColumn("Codigo");
modelouni.addColumn("Nombre");
modelouni.addColumn("Direccion");
modelouni.addColumn("Ciudad");
modelouni.addColumn("Telefono");
modelouni.addColumn("E-mail");
modelouni.addColumn("Categoria");
tabla_univer.setModel(modelouni);
String []datos_uni= new String[7];
try {
Statement stu=con.createStatement();
ResultSet resul_uni=stu.executeQuery("SELECT * FROM Universidad");
while(resul_uni.next()){
datos_uni[0]=resul_uni.getString(1);
datos_uni[1]=resul_uni.getString(2);
datos_uni[2]=resul_uni.getString(3);
datos_uni[3]=resul_uni.getString(4);
datos_uni[4]=resul_uni.getString(5);
datos_uni[5]=resul_uni.getString(6);
datos_uni[6]=resul_uni.getString(7);
modelouni.addRow(datos_uni);
}
tabla_univer.setModel(modelouni);
} catch (SQLException ex) {
Logger.getLogger(Formulario_Datos.class.getName()).log(Level.SEVERE,
null, ex);
}
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

u_nom = new javax.swing.JTextField();


u_ciud = new javax.swing.JTextField();
u_dir = new javax.swing.JTextField();
u_tel = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
u_cod = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();
u_mail = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
u_cate = new javax.swing.JTextField();
jScrollPane1 = new javax.swing.JScrollPane();
tabla_univer = new javax.swing.JTable();
jButton4 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jButton1.setText("Nuevo");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setText("Enviar");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton3.setText("Salir");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jLabel1.setText("UNIVERSIDADES");
jLabel2.setText("Nombre");
jLabel3.setText("Cuidad");
jLabel4.setText("Direccion");
jLabel5.setText("Telefono");
jLabel6.setText("Codigo");
jLabel7.setText("E-mail");
jLabel8.setText("Categoria");
tabla_univer.setModel(new javax.swing.table.DefaultTableModel(

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

new Object [][] {


},
new String [] {
}
));
jScrollPane1.setViewportView(tabla_univer);
jButton4.setText("Mostrar");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
javax.swing.GroupLayout
layout
=
new
javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(38, 38, 38)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)
.addComponent(jLabel4)
.addComponent(jLabel6))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELA
TED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(u_cod,
javax.swing.GroupLayout.PREFERRED_SIZE,
69,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(30, 30, 30)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.R
ELATED)
.addComponent(u_nom,
javax.swing.GroupLayout.PREFERRED_SIZE,
183,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel8))
.addGroup(layout.createSequentialGroup()
.addComponent(u_dir,
javax.swing.GroupLayout.PREFERRED_SIZE,
140,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel3,
javax.swing.GroupLayout.PREFERRED_SIZE,
43,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.R
ELATED)

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)

.addComponent(u_ciud,
117,

.addComponent(jLabel7,
javax.swing.GroupLayout.PREFERRED_SIZE,
39,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.TRAILING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(u_cate,
javax.swing.GroupLayout.PREFERRED_SIZE,
43,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel5)
.addGap(18, 18, 18)
.addComponent(u_tel,
javax.swing.GroupLayout.PREFERRED_SIZE,
72,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(u_mail))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELA
TED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)
.addComponent(jButton1)
.addComponent(jButton2))
.addGap(51, 51, 51))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(381, 381, 381)
.addComponent(jLabel1))
.addGroup(layout.createSequentialGroup()
.addGap(73, 73, 73)
.addComponent(jScrollPane1,
javax.swing.GroupLayout.PREFERRED_SIZE,
766,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(83, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addComponent(jButton4)
.addGap(40, 40, 40)
.addComponent(jButton3)
.addGap(61, 61, 61))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addGap(7, 7, 7)

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE,
14, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRE
LATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.BASELINE)
.addComponent(u_nom,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2)
.addComponent(u_cod, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel8)
.addComponent(u_cate,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6)
.addComponent(jLabel5)
.addComponent(u_tel, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRE
LATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.BASELINE)
.addComponent(u_dir, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4)
.addComponent(jLabel3)
.addComponent(u_ciud,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7)
.addComponent(u_mail,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELA
TED, 39, Short.MAX_VALUE)
.addComponent(jScrollPane1,
javax.swing.GroupLayout.PREFERRED_SIZE,
118,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.BASELINE)
.addComponent(jButton3)
.addComponent(jButton4))

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

.addGap(30, 30, 30))


);
pack();
}// </editor-fold>
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
u_cod.setText("");
u_nom.setText("");
u_ciud.setText("");
u_tel.setText("");
u_mail.setText("");
u_cate.setText("");
u_dir.setText("");
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
test_conect con=new test_conect();
Connection reg= con.conexion();
String cod, nom, ciud,tel,mail,cate,dir;
String sql;
cod=u_cod.getText();
nom=u_nom.getText();
dir=u_dir.getText();
tel=u_tel.getText();
mail=u_mail.getText();
ciud=u_ciud.getText();
cate=u_cate.getText();
sql="INSERT
INTO
Universidad
(idUniversidad,
Nombre,Direccion,Telefono,Email,Categoria,Ciudad)VALUES (?,?,?,?,?,?,?)";
try {
PreparedStatement pst=reg.prepareStatement(sql);
pst.setString(7,ciud);
pst.setString(1,cod);
pst.setString(2,nom);
pst.setString(3,dir);
pst.setString(4,tel);
pst.setString(5,mail);
pst.setString(6,cate);
int n=pst.executeUpdate();
if (n>0){
JOptionPane.showMessageDialog(null,"REGISTROS EXITOSO");
mostrardatosunviersidad();
}
} catch (SQLException ex) {
System.out.print(ex);
JOptionPane.showMessageDialog(null,"CODIGO PRIMARIO ERRONEO");
//Logger.getLogger(Formulario_Datos.class.getName()).log(Level.SEVERE,
null, ex);
}
}
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
test_conect con=new test_conect();
con.conexion();
}

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {


this.setVisible(false);
}
public static void main(String args[]) {
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code
(optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default
look and feel.
*
For
details
see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Formulario_Datos.class.getName()).log(j
ava.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Formulario_Datos.class.getName()).log(j
ava.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Formulario_Datos.class.getName()).log(j
ava.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Formulario_Datos.class.getName()).log(j
ava.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Formulario_Datos().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable tabla_univer;

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

private javax.swing.JTextField u_cate;


private javax.swing.JTextField u_ciud;
private javax.swing.JTextField u_cod;
private javax.swing.JTextField u_dir;
private javax.swing.JTextField u_mail;
private javax.swing.JTextField u_nom;
private javax.swing.JTextField u_tel;
// End of variables declaration
}
MALLA CURRICULAR:
package conexion;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
/**
*
* @author Davidherrera
*/
public class MALLA_CURRICULAR extends javax.swing.JFrame {
public MALLA_CURRICULAR() {
initComponents();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
codigo = new javax.swing.JTextField();
nombre = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setText("MALLA CURRICULAR");
jLabel2.setText("Codigo");
jLabel3.setText("Nombre");
jButton1.setText("Registrarse");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

javax.swing.GroupLayout
layout
=
new
javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(111, 111, 111)
.addComponent(jLabel1))
.addGroup(layout.createSequentialGroup()
.addGap(58, 58, 58)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.LEADING, false)
.addComponent(jLabel2,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel3,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(43, 43, 43)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.LEADING, false)
.addComponent(codigo)
.addComponent(nombre,
javax.swing.GroupLayout.DEFAULT_SIZE, 94, Short.MAX_VALUE)))
.addGroup(layout.createSequentialGroup()
.addGap(97, 97, 97)
.addComponent(jButton1)))
.addContainerGap(43, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)
.addComponent(jLabel2)
.addComponent(codigo,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)
.addComponent(jLabel3,
javax.swing.GroupLayout.PREFERRED_SIZE,
19,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(nombre,
javax.swing.GroupLayout.PREFERRED_SIZE,

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jButton1)
.addContainerGap(56, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
test_conect con=new test_conect();
Connection reg= con.conexion();
String cod, nom, cd,tel,mail,dir;
String sql;
cod=codigo.getText();
nom=nombre.getText();
//INSERT INTO `MALLA CURRICULAR`(`idMALLA CURRICULAR`, `Nombre`)
VALUES ([value-1],[value-2])
sql="INSERT INTO `MALLA CURRICULAR` (`idMALLA CURRICULAR`,
`Nombre`)VALUES (?,?)";
try {
PreparedStatement pst=reg.prepareStatement(sql);
pst.setString(1,cod);
pst.setString(2,nom);
int n=pst.executeUpdate();
if (n>0){
JOptionPane.showMessageDialog(null,"REGISTRO EXITOSO");
}
} catch (SQLException ex) {
Logger.getLogger(MALLA_CURRICULAR.class.getName()).log(Level.SEV
ERE, null, ex);
}
}
public static void main(String args[]) {
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code
(optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default
look and feel.
*
For
details
see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(MALLA_CURRICULAR.class.getName())
.log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

java.util.logging.Logger.getLogger(MALLA_CURRICULAR.class.getName())
.log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(MALLA_CURRICULAR.class.getName())
.log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(MALLA_CURRICULAR.class.getName())
.log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new MALLA_CURRICULAR().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JTextField codigo;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JTextField nombre;
// End of variables declaration
}
TEST CONEXIN:
package conexion;
import java.sql.*;
import javax.swing.JOptionPane;
/**
*
* @author Alexander
*/
public class test_conect {
Connection con=null;
public Connection conexion(){
try{
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://172.21.123.65:3306/villago
mezdd","villagomezdd","villagomezdd");
System.out.println("conexion establecida");
} catch (ClassNotFoundException | SQLException e) {
System.out.println("error de conexion");
JOptionPane.showMessageDialog(null, "error de conexion "+e);
}
return con;
}
}

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

FACULTAD DE INGENIERIA EN SISTEMAS, ELECTRONICA E INDUSTRIAL

UNIVERSIDAD TCNICA DE AMBATO

F . I . S . E E. INDUSTRIAL
I
FACULTAD DE INGENIERA EN SISTEMAS, ELECTRNICA
PERODO ACADMICO: SEPTIEMBRE/2015 FEBRERO/2016

Das könnte Ihnen auch gefallen