Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Join Date
    Mar 2004
    Posts
    16

    Unanswered: Connection question.

    Hi, sorry if i ask a stupid question i am a bit of a newbie.
    The thing is, that i use command centre at university and i want to continue work at home. How do i create, like a local database, or connect to my hard disk rather than some server? Its a very simple database i am creating...typical book database.
    Thanks in advance for the help!

    If there are any other softwares which are easier to setup, please let me know...thanks!

  2. #2
    Join Date
    May 2002
    Location
    General Deheza, Cba, Arg.
    Posts
    276

    Re: Connection question.

    Hi mbrindley.

    What is your db2 version?
    is UDB (win/linux) or is a AS?

    Can you backup and restore the DB in your PC?

  3. #3
    Join Date
    Mar 2004
    Posts
    16
    Hi....its DB2 version 7
    Win

    and i dont quite understand your question about backup and restore, sorry...maybe if i explain what i would like to do...

    I am just starting to make a database for books, its simple, about 6 tables and simple queries...all i want to do, is create this DB on my PC and test the queries...i have to imput data into this DB as well to test it.....i have a list of queries i have to try and get working....

    thanks for the help!

  4. #4
    Join Date
    May 2002
    Location
    General Deheza, Cba, Arg.
    Posts
    276
    Hi,

    Your db are in server and you carry this DB to your PC?
    If is this.
    You can make a backup of your DB, and then restore this in your PC.

  5. #5
    Join Date
    May 2002
    Location
    General Deheza, Cba, Arg.
    Posts
    276

    Post

    Sorry by my english.
    I speck spanish.

  6. #6
    Join Date
    Mar 2004
    Posts
    16
    Hola...yo hablo spanish....soy chileno

    No se si entendiste lo q quiero hacer, pero tengo unas tareas q hacer y bueno, quiero hacerlas en casa y no en la universidad.
    Es muy simple la DB. De hecho aun no la empiezo, asi que quiero crearlo en mi PC de casa...pero no se como hacerlo por q me pide conectarme a un servidor y en mi casa no tengo servidor, solo internet...perdon, soy muy principiante y no se si esto es possible....

    La DB es de una biblioteca, tengo q crear unas tablas y despues hacer unos busquedas y cosas asi muy simples...en fin, lo q necesito hacer es usar el DB2 en mi hogar para crear una DB y hacer queries....


    gracias por tu ayuda!

  7. #7
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    If your univ server is also windows, then you can backup the db and then transfer it to your home Pc and do a restore ...

    Commands you will need :
    On Univ server :
    db2 force application all
    db2 backup database sample to C:\

    The will create a directory SAMPLE.0 in C drive ... Copy this directory and all sub-directories to your home PC ...

    On Home PC :

    db2 restore database sample from c:

    And then you can connect to sample and continue your work

    If there is no facility to transfer the univ db to your home pc this way, then on the univ PC , do

    db2look -d sample -a -e -o sample.ddl

    make a list of tables and for each table do

    db2 export to table1.del of del select * from table1

    Copy the sample.ddl file and the .del files to some media(floppy ? ) ..


    On your home PC, create a database using

    db2 create database sample
    db2 connect to sample
    db2 -tvf sample.ddl (You may want to edit the ddl file to see what you want and what you don't )
    for each table exported,
    db2 import from table1.del of del commitcount 100 insert into table1

    As you are a student, I need not tell that you'll have to populate the parent tables before the child tables in a RI Relationship ...

    Good luck

    Sathyaram
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  8. #8
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    hmmm ... When am I going to learn Spanish ?????
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  9. #9
    Join Date
    Mar 2004
    Posts
    16
    ill trade my knowledge of Spanish for your SQL!!! hehehehe


    when i try to do the
    connect to sample

    i get this error:

    SQL1031N The database directory cannot be found on the indicated file system.

    SQLSTATE=58031

    i should be doing this in Command Center right?
    sorry for being such a newbie!!!!

  10. #10
    Join Date
    May 2002
    Location
    General Deheza, Cba, Arg.
    Posts
    276
    HOLA (mucho mas facil).

    Te cuento que el error sql1031 es porque la db no ha sido creada o catalogada correctamente.

    pasame como hiciste para crear la db que seguramente hay se encuentra el problema.

    Saludos, abel.

  11. #11
    Join Date
    Mar 2004
    Posts
    16

    achiola

    Hola...lo cree como dice sathyaram_s...no se si asi se hace.
    me podrias decir tu como hacerlo?

    lo q me cuesta hacer es crear la db en mi disco duro para despues poder hacer queries con datos q ingreso....

    esto es lo q he hecho hasta ahora, pero en notepad no mas:

    ************************************************** **********

    CREATE TABLE Category
    (
    CategoryID INTEGER NOT NULL UNIQUE,
    Name VARCHAR(50) NOT NULL UNIQUE,
    CategoryType VARCHAR(20) NOT NULL,
    CHECK (CategoryType IN ('Fiction', 'Non-Fiction))
    CONSTRAINT Category_pk PRIMARY KEY (CategoryID)
    );

    CREATE TABLE SalesRep
    (
    SalesRepID INTEGER NOT NULL,
    Name VARCHAR(50) NOT NULL,
    CONSTRAINT SalesRep_pk PRIMARY KEY (SalesRepID)
    );

    CREATE TABLE Shop
    (
    ShopID INTEGER NOT NULL,
    Name VARCHAR(50) NOT NULL
    CONSTRAINT Shop_pk PRIMARY KEY (ShopID)
    )

    CREATE TABLE Publisher
    (
    PublisherID INTEGER NOT NULL,
    Name VARCHAR(50) NOT NULL
    CONSTRAINT Publisher_pk PRIMARY KEY (PublisherID)
    )

    CREATE TABLE Book
    (
    BookID INTEGER NOT NULL,
    Title VARCHAR(50) NOT NULL,
    Price DECIMAL(10,2),
    CategoryID INTEGER NOT NULL,
    PublisherID INTEGER NOT NULL,
    FOREIGN KEY (CategoryID) REFERENCES Category (CategoryID),
    FOREIGN KEY (PublisherID) REFERENCES Publisher (PublisherID),
    CONSTRAINT Book_pk PRIMARY KEY (BookID)
    )

    CREATE TABLE ShopOrder
    (
    ShopOrderID INTEGER NOT NULL,
    OrderDate DATE,
    ShopID INTEGER NOT NULL,
    SalesRepID INTEGER NOT NULL,
    FOREIGN KEY (ShopID) REFERENCES Shop (ShopID),
    FOREIGN KEY (SalesRepID) REFERENCES SalesRep (SalesRepID),
    CONSTRAINT ShopOrder_pk PRIMARY KEY (ShopOrderID)
    )

    CREATE TABLE OrderLine
    (
    ShopOrderID INTEGER NOT NULL,
    BookID INTEGER NOT NULL,
    Quantity INTEGER NOT NULL,
    UnitSellingPrice DECIMAL(10,2),
    FOREIGN KEY (ShopOrderID) REFERENCES ShopOrder (ShopOrderID),
    FOREIGN KEY (BookID) REFERENCES Book (BookID)

    )

  12. #12
    Join Date
    May 2002
    Location
    General Deheza, Cba, Arg.
    Posts
    276

    Re: achiola

    ok.
    Eso son los ddl de las tablas.
    Primero debes crear la base de datos.
    Esto lo puedes hacer por codigo o por el centro de control de forma grafica.

    Para crear una db desde la linea de comandos debes:
    Ej.
    "CREATE DATABASE MYDB ON E: ALIAS MyDB;"
    Existen un monto de parametos para crear una base de datos. Estos los puedes ver ejecutando el siguiente comando:
    ? CREATE DATABASE


    O haciendo un click derecho en el centro de control, seleccionando "nuva base de datos" y siguiendo las instrucciones.

    Una vez creada si podrias conectarte:
    connect to mydb user <usuarui>

    Y luego crea las tablas que quieres, te recomiendo que utilices el centrol de control, ya que es gráfico y muy facil de utilizar.

    Espero haber sido claro.
    De lo contrario avisame.
    Saludos, Abel.

  13. #13
    Join Date
    Mar 2004
    Posts
    16
    Hola...perdon...pero no me sale....me salen estos errores.
    si tienes tiempo, muchas gracias por la ayuda
    no se me crea la DB y no me puedo conectar....
    existen algunos programas mas faciles????




    ------------------------------ Command Entered ------------------------------
    CREATE DATABASE MYDB ON c: ALIAS MyDB;

    -----------------------------------------------------------------------------
    SQL1000N "MyDB;" is not a valid database alias name.
    Last edited by mbrindley; 03-22-04 at 18:34.

  14. #14
    Join Date
    May 2002
    Location
    General Deheza, Cba, Arg.
    Posts
    276
    Hola,
    No hay problemas, puedes hacer las consultas que quieras. Para esto son los foros.

    Te pido que ejecutes el mismo comando pero sin el punto y coma (. seguramente esto esta haciendo algun problema.

    Si esto no funciona, ejecuta el siguiente comando y fijate si existe alguna db con el alias/nombre "MyDB".

    list database directory

    Saludos, Abel.

  15. #15
    Join Date
    Mar 2004
    Posts
    16
    muchas gracias por tu ayuda! mira, lo hice denuevo sin el ";" y me sale esto:

    ------------------------------ Command Entered ------------------------------
    CREATE DATABASE MYDB ON c: ALIAS MyDB

    -----------------------------------------------------------------------------
    SQL1032N No start database manager command was issued. SQLSTATE=57019

    y cuando hago list database directory, me sale esto......


    ------------------------------ Command Entered ------------------------------
    list database directory

    -----------------------------------------------------------------------------
    SQL1031N The database directory cannot be found on the indicated file system.

    SQLSTATE=58031

    MUCHAS GRACIAS NUEVAMENTE

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •