Ver Mensaje Individual
  #3 (permalink)  
Antiguo 26/11/2009, 22:17
alx_salazar
 
Fecha de Ingreso: septiembre-2008
Mensajes: 192
Antigüedad: 15 años, 7 meses
Puntos: 1
Respuesta: aUXILIO!!!! Ayuda muy importante n se que le pasa a java con mysql

muchas gracias por la observacion fue ese problema pero me pueds ayudar con las claves foraneas de 1 a n soy nuevo en mysql y npo lo entiendo te envio el scrip de mi base si ni es mucha molestia por favor revisale para ver las claves foranes te agradezco estoy sobre tiempo

MySQL Administrator dump 1.4
--
-- ------------------------------------------------------
-- Server version 5.0.19-nt


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;


--
-- Create schema biblioteca
--

CREATE DATABASE IF NOT EXISTS biblioteca;
USE biblioteca;

--
-- Definition of table `autor`
--

DROP TABLE IF EXISTS `autor`;
CREATE TABLE `autor` (
`cod_autor` int(10) unsigned NOT NULL auto_increment,
`nom_autor` varchar(45) NOT NULL,
`ape_autor` varchar(45) NOT NULL,
PRIMARY KEY (`cod_autor`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `autor`
--

/*!40000 ALTER TABLE `autor` DISABLE KEYS */;
INSERT INTO `autor` (`cod_autor`,`nom_autor`,`ape_autor`) VALUES
(1,'Carlos','Garces'),
(2,'Esteban','CArlosama'),
(3,'Jose','Avila');
/*!40000 ALTER TABLE `autor` ENABLE KEYS */;


--
-- Definition of table `editorial`
--

DROP TABLE IF EXISTS `editorial`;
CREATE TABLE `editorial` (
`cod_editorial` int(10) unsigned NOT NULL auto_increment,
`nom_editorial` varchar(45) NOT NULL,
`direccion_editorial` varchar(45) NOT NULL,
`email_editorial` varchar(45) default NULL,
`telf_editorial` varchar(10) NOT NULL,
PRIMARY KEY (`cod_editorial`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `editorial`
--

/*!40000 ALTER TABLE `editorial` DISABLE KEYS */;
INSERT INTO `editorial` (`cod_editorial`,`nom_editorial`,`direccion_editor ial`,`email_editorial`,`telf_editorial`) VALUES
(1,'LOS ANDES','ibarra','[email protected]','062956241'),
(2,'offset ','QUito','[email protected]','062356548'),
(3,'Caritas','GUayaquil','[email protected]','09 8745855');
/*!40000 ALTER TABLE `editorial` ENABLE KEYS */;


--
-- Definition of table `libro`
--

DROP TABLE IF EXISTS `libro`;
CREATE TABLE `libro` (
`cod_libro` int(10) unsigned NOT NULL auto_increment,
`nom_libro` varchar(45) NOT NULL,
`tema_libro` varchar(45) NOT NULL,
`desc_libro` varchar(400) default NULL,
`año_libro` varchar(45) default NULL,
`num_libro` varchar(4) NOT NULL,
`cod_autor` int(10) unsigned NOT NULL,
`cod_editorial` int(10) unsigned NOT NULL,
PRIMARY KEY (`cod_libro`),
KEY `FK_cod_autor` (`cod_autor`),
KEY `FK_cod_editorial` (`cod_editorial`),
CONSTRAINT `FK_cod_autor` FOREIGN KEY (`cod_libro`) REFERENCES `libro` (`cod_libro`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `FK_cod_editorial` FOREIGN KEY (`cod_editorial`) REFERENCES `editorial` (`cod_editorial`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `libro`
--

/*!40000 ALTER TABLE `libro` DISABLE KEYS */;
INSERT INTO `libro` (`cod_libro`,`nom_libro`,`tema_libro`,`desc_libro` ,`año_libro`,`num_libro`,`cod_autor`,`cod_editoria l`) VALUES
(1,'fisica','cinematica','fundamentos de fisica','1995','2',1,2),
(2,'matematica','ecuaciones','ecuaciones inecuaciones','1994','1',2,3),
(3,'Quimica general','Fundamentos de Quimica','quimica general','2002','1',3,1);
/*!40000 ALTER TABLE `libro` ENABLE KEYS */;


--
-- Definition of table `presta_libro`
--

DROP TABLE IF EXISTS `presta_libro`;
CREATE TABLE `presta_libro` (
`fecha_presta` varchar(20) NOT NULL,
`fecha_devo` varchar(20) default NULL,
`cod_libro` int(10) unsigned NOT NULL,
`ci_usuario` int(10) unsigned NOT NULL,
KEY `FK_cod_libro` (`cod_libro`),
KEY `FK_cod_usuario` USING BTREE (`ci_usuario`),
CONSTRAINT `FK_ci_usuario` FOREIGN KEY (`ci_usuario`) REFERENCES `usuario` (`ci_usuario`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `FK_cod_libro` FOREIGN KEY (`cod_libro`) REFERENCES `libro` (`cod_libro`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `presta_libro`
--

/*!40000 ALTER TABLE `presta_libro` DISABLE KEYS */;
INSERT INTO `presta_libro` (`fecha_presta`,`fecha_devo`,`cod_libro`,`ci_usuar io`) VALUES
('10/10/2008','',1,1002985362),
('10/11/2008','',2,1002985363);
/*!40000 ALTER TABLE `presta_libro` ENABLE KEYS */;


--
-- Definition of table `usuario`
--

DROP TABLE IF EXISTS `usuario`;
CREATE TABLE `usuario` (
`ci_usuario` int(10) unsigned NOT NULL auto_increment,
`nom_usuario` varchar(45) NOT NULL,
`ape_usuario` varchar(45) NOT NULL,
`dir_usuario` varchar(45) NOT NULL,
`email_usuario` varchar(45) default NULL,
`tel_usuario` varchar(10) default NULL,
PRIMARY KEY (`ci_usuario`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `usuario`
--

/*!40000 ALTER TABLE `usuario` DISABLE KEYS */;
INSERT INTO `usuario` (`ci_usuario`,`nom_usuario`,`ape_usuario`,`dir_usu ario`,`email_usuario`,`tel_usuario`) VALUES
(1002985362,'Andres','Castillo','ibarra','andres@h otmail.com','062932860'),
(1002985363,'Carla','Andrade','los ceibos','[email protected]','062956321'),
(1002985364,'Diego','CArlos','Guayaquil','diego@ho tmail.com','062458792'),
(1002985367,'asd','asdaa','ASDASD','062932879','as dasd');
/*!40000 ALTER TABLE `usuario` ENABLE KEYS */;




/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;