Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

jdbc-sql

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just started using jdbc after a long time so am not sure about the table creation syntax in mysql.I think it has something to do with indexing.

any help would be appreciated.
*********************************************
mysql> create table county ( countynumber integer not null auto_increment,
-> countyname varchar(32),
-> state varchar(32),
-> primary key(countynumber));
Query OK, 0 rows affected (0.38 sec)

mysql> create table voterregistration(
-> ssn integer not null,
-> firstname varchar(32) not null,
-> lastname varchar(32) not null,
-> countynumber integer not null,
-> primary key(ssn),
-> foreign key(countynumber) references county);
ERROR 1005 (HY000): Can't create table '.\jspexample\voterregistration.frm' (err
no: 150)
 
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not to sound mean or demeaning, but try the forums at www.mysql.org
 
ahsan mir
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my mistake:-(

the following works:

*****************************************
ALTER TABLE county ADD INDEX(countynumber);

> create table voterregistration(
-> ssn integer not null,
-> firstname varchar(32) not null,
-> lastname varchar(32) not null,
-> countynumber integer not null,
-> primary key(ssn),
-> foreign key(countynumber) references county(countynumber))
-> ENGINE=InnoDB;
Query OK, 0 rows affected (0.11 sec)
 
I brought this back from the farm where they grow the tiny ads:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic