vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, I'm quite new to DB2. I've created a db scheme with DBDesigner4 and then I created an export file with all the sql statements. Now I'm wondering if at all and if yes how it is possible to create tables from a sql dump. Or should I use other tools? regards, Franz |
| |||
| Franz Demmel wrote: > Hi, > > I'm quite new to DB2. I've created a db scheme with DBDesigner4 and then > I created an export file with all the sql statements. Now I'm wondering > if at all and if yes how it is possible to create tables from a sql > dump. Or should I use other tools? This is a bit vague. Care to post some representative peice of this "SQL dump"? If you also have the CREATE TABLE statements then all you may need to do is execute db2 -t<yourdelimiter> -f <filename> -- Serge Rielau DB2 Solutions Development IBM Toronto Lab |
| |||
| Franz Demmel wrote: > Hi, > > I'm quite new to DB2. I've created a db scheme with DBDesigner4 and then > I created an export file with all the sql statements. Now I'm wondering > if at all and if yes how it is possible to create tables from a sql > dump. Or should I use other tools? > > regards, > > Franz run the script as follows from a telnet session or command window: db2 -tvf script-name.ddl > results.out |
| |||
| Serge Rielau wrote > This is a bit vague. Care to post some representative peice of this "SQL > dump"? > If you also have the CREATE TABLE statements then all you may need to do > is execute db2 -t<yourdelimiter> -f <filename> The whole sql file is just for creating table. Here is a part of the sql file: .... CREATE TABLE category ( id INTEGER NOT NULL AUTO_INCREMENT, category CHAR(255)) NULL, PRIMARY KEY(id) ); CREATE TABLE user_context_history ( id INTEGER NOT NULL AUTO_INCREMENT, users_fkid INTEGER NOT NULL, longitude DOUBLE NULL, latitude DOUBLE NULL, category INTEGER NULL, PRIMARY KEY(id, users_fkid), FOREIGN KEY(users_fkid) REFERENCES users(id) ON DELETE NO ACTION ON UPDATE NO ACTION ); .... When I tried: db2 -t ; -f d:\db.sql I get the following error: DB21034E The command was processed as an sql command.... SQL processing: SQL1024N No connection to database. But in the command centre I right-clicked on the database and selected connect. By the way. I can't figure out at which port db2 is listening. |
| |||
| m0002a@yahoo.com schrieb: > You need to run: > db2 connect to database-name; (or include it in your script) > > You find the port with db2 get dbm cfg > If it lists a service name, then you need to look in /etc/services for > the translation. The default is 50000. > Thanks. I will try. As you see my questions are very simple. Is there a good resource for DB2 to lookup such essential infos? The manual provided by IBM very, very detailed and it's hard to find such information very quickly. |