Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating a new mdb table

Status
Not open for further replies.

ptrj

Programmer
Feb 22, 2006
10
BE
hello,
I want to create a table in cobol, can someone tell me what's wrong?...

000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. cvsMaakTabel.

ENVIRONMENT DIVISION.

DATA DIVISION.
working-storage section.
01 einde pic 9 value 0.
01 verder pic x.

PROCEDURE DIVISION.
Pgm.
perform dbconnect

EXEC SQL
CREATE TABLE AAA (ProductName, ProductDate)
end-exec.


display "done"
accept verder
perform dbdisconnect
stop run.

dbconnect.
exec SQL
connect to "jdbc:eek:dbc:Driver={Microsoft Access Driver (*.mdb)};
DBQ=C:\sDoc\testje.mdb"
DRIVER "sun.jdbc.odbc.JdbcOdbcDriver"
end-exec
exec SQL
set transaction write only
end-exec

dbdisconnect.
exec SQL
close cur
end-exec.
exec SQL
commit
disconnect
end-exec.
 
You haven't cobol issue but lack of SQL knowledge.
Consult your RDBMS manual to know how to write DDL code.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
You should check the sqlcode on return from the create table statement execution. This will give you an error code which should lead you to the problem determination.
 
antother example from the internet:

EXEC SQL
create table haaaaaaaa
(
firstname varchar(20),
lastname varchar(20),
description varchar(70)
)

end-exec.
this is 100% true exect sql.
but it doesnt work with me. what do i have to change? maby the "set transaction" ore something else..
 
Does your RDBMS support varchar ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I don't think that Access does support VARCHAR. Try defining them as CHAR.
 
Tip: test your sql in the SQL view pane of the access's query window before executing it from cobol without testing any return code ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top