If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > HELP! insert record

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-30-03, 04:08
jess88 jess88 is offline
Registered User
 
Join Date: Sep 2003
Posts: 12
HELP! insert record

I'm doing a program by using Java to insert record into SQL file. it's a registration program. but i'm not familiar with SQL, i got an error msg "An attempt was made to insert a null value into a column that does not accept nulls. " and i cant solve it. my SQL file contains

connect 'jdbc:rmi://localhost:1099/jdbc:cloudscape:customers;create=true'
;

drop table custProducts
;
drop table products
;
drop table custinfor
;

create table custinfor (
userName varchar (20) NOT NULL,
firstName varchar (20) NOT NULL,
lastName varchar (30) NOT NULL,
email varchar (30) NOT NULL,
password varchar (20) NOT NULL,
verify varchar (20) NOT NULL,
constraint pk_custinfor primary key (userName)
)
;
create table products (
productID int DEFAULT AUTOINCREMENT,
productName varchar (100) NOT NULL,
description varchar (100) NOT NULL,
price real NOT NULL,
imageFile varchar (50) NOT NULL,
constraint pk_products primary key (productID)
)
;
create table custProducts (
userName varchar (20) NOT NULL,
productID int NOT NULL,
constraint fk_custProducts_1 foreign key (userName)
references custinfor (userName),
constraint fk_custProducts_2 foreign key (productID)
references products (productID)
)
;
insert into custinfor (userName,firstName,lastName,email,password,verify ) values ('jSmith','John','Smith','sjohn@hotmail.com','jsmi th123','jsmith123')
;
insert into custinfor (userName,firstName,lastName,email,password,verify ) values ('jess88','Jess','Ling','jess88@yahoo.com','jess45 6','jess456')
;

insert into products (productName,description,price,imageFile) values ('Desktop-1','Intel Pentium 4 Processor 1.8Gb,256MB RAM',2998.00,'pentium4 processor.jpg')
;
insert into products (productName,description,price,imageFile) values ('Desktop-2','Intel Celeron Processor,256MB RAM',2260.00,'pentium4 processor.jpg')
;

insert into custProducts (userName,productID) values ('jSmith',1)
;
insert into custProducts (userName,productID) values ('jess88',2)
;

can someone tell me what's the mistake that i made?
Reply With Quote
  #2 (permalink)  
Old 10-01-03, 10:21
Avatar Avatar is offline
Registered User
 
Join Date: Oct 2003
Location: Buenos Aires, Argentina
Posts: 20
Talking Re: HELP! insert record

Hi:

Look... your problem is easy.
Please, try to execute one insert at the time and then you can figure which sentence has the problem.
One of them is tryng to insert a null value in a null column.
__________________
------------------------------------
Thanx
------------------------------------
http://www.iespana.es/greatavatar/FIRMA/firma.jpg
Reply With Quote
  #3 (permalink)  
Old 10-01-03, 10:58
moku moku is offline
Registered User
 
Join Date: Sep 2003
Location: Wisconsin, USA
Posts: 34
hrmm

At first glance, everything in your SQL looks good. I notice that you probably should handle the users' password verification in the UI instead of the DB, but that's a minor nit-pick.

Which statement gives you the error?
Reply With Quote
  #4 (permalink)  
Old 10-03-03, 02:45
jess88 jess88 is offline
Registered User
 
Join Date: Sep 2003
Posts: 12
thanks moku and avarta. i cancelled the some of the NOT NULL and it works. thanks.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On