Page 1 of 2 12 LastLast
Results 1 to 15 of 26
  1. #1
    Join Date
    Jun 2012
    Posts
    13

    Unanswered: JDBC:DB2 No connection to database

    Hi,

    I am new with DB2, but I have to run an old Java application.

    The used database version is (db2level -->) "DB2 v7.1.0". I installed this version and see in Task-Manager the db2bp, db2ccs, db2govds, db2jds, db2sec, db2syscs running processes.

    I try to connect with Java trough
    COM.ibm.db2.jdbc.net.DB2Driver
    COM.ibm.db2.jdbc.app.DB2Driver
    sun.jdbc.odbc.JdbcOdbcDriver
    failes.

    The parameter for connection are:
    Protokoll: jdbc:db2
    Portnumber: 6790 (I do not know, is this right or not, because Google puts mostly 50000!?)
    User: db2admin
    Password: myPassword

    All tries with protocol://hostort/database or with protocol:database failed.

    The old databases are by the command center started with C:\Programme\SQLLIB\bin\db2cc.bat are to see. But A an attempt to access to the databases generates following error: "[IBM][CLI Driver] SQL1032N The command DB2START could not be started. SQLSTATE=57019", (I translated from german).

    And I have the databases created by Datesources (ODBC) + System-DSN I thought these will be need, I do not know.

    Please help me to start DB2 and access the data.

    Thanks,

    Globe

  2. #2
    Join Date
    Apr 2012
    Posts
    1,035
    Provided Answers: 18
    Which version of Windows?

    Is the DB2 server running on the same machine where you are trying to connect?

    The database manager (db2) needs to be already running on the server, before you can connect. To start the database manager please run (on the machine where DB2-server runs) the command: DB2CMD.EXE and then in that window run db2start.

    Once the database manager is started successfully, discover which port it listens on (the default is 50000). In the DB2CMD.EXE window you can use
    db2 get dbm cfg | find "SVCENAME"
    This will tell you either a number (the port number) or a port-name.
    If it is a name like db2_db2c then lookup the port-number in
    %windir%\system32\drivers\etc\services
    by searching for the port-name that you found form the previous command.

    Please look at the many sample JAVA programs that IBM provided with DB2 version 7.1 in the directory \Program Files\IBM\sqllib\samples\java

    These example programs will show what you must do.

    But if you are smart you will stop using DB2 v7.1 and move to a modern version like v9.7 or v10.1.

  3. #3
    Join Date
    Jun 2012
    Posts
    13
    Hi,

    yes DB2 server running on the same machine.

    The db2start command in DB2CMD windows respondes SQL1026N The database manager is already activated.

    And the db2 get dbm cfg | find "SVCENAME" return TCP/IP-Servicename (SVCENAME) = db2cDB2. And the db2cDB2 has the defaul value 50000.

    I am using Windows XP Home Editin Version 2002 Service Pack 2. This is the original machine where this application developed.

    Is it possible to migrate without expert know-how to a higher version of DB2, v9.7 or higher? Is it possible to export the old data as a SQL file?

    Thanks,

    Globe

  4. #4
    Join Date
    Apr 2012
    Posts
    1,035
    Provided Answers: 18
    To answer your original question then, you should be able to connect to your database if you specify the correct database-name and port 50000, with a valid userid/password in a valid connection-string.

    Be sure to study the sample java (jdbc) programs that IBM provided to see the connection string details. These samples will answer many of your questions.

    If the budget and application-lifetime and resources/skill-sets justifies it, then you could move to a version of DB2 that is currently supported by IBM. You can move your data from v7.1 to v9.7 or higher, although you should also consider moving to a more modern version of Windows at the same time (or Linux etc), and converting to 64-bit from 32-bit etc.

    There is more than one way to move the data from V7.1, but creating SQL files (with insert statements) is not a sensible method for non-trivial volumes. Migrating the data does require some specialist knowledge, but patience gets you a long way.

    Look in the V7 documentation for the db2look command which lets you capture the DDL of the database - you can then run that DDL against a V9.7 database.
    You can also export the tables content to delimited-files, and then load or import these files into a database created on a modern version of DB2.
    Look also in the DB2 v7.1 documentation for details of the db2move command.
    DB2-Backup-And-Restore is only possible if your company has a DB2 v8 environment (you cannot restore a V7.x database into V9.7 - you must go via V8).

  5. #5
    Join Date
    Jun 2012
    Posts
    13
    Hi,

    if I somehow could start my application with DB2 access, the I could export my old data. But there is the connection not existing.

    In our old sources are the connetion parameters from my first message. Do you know about java/jdbc/db2 connection enviorenment?

    Thanks,
    Globe

  6. #6
    Join Date
    Apr 2012
    Posts
    1,035
    Provided Answers: 18
    When you put the correct port number into the connection string (50000) do you still get SQL1032N from the connect?

  7. #7
    Join Date
    Jun 2012
    Posts
    13
    Yes so is it.

    In my stone old PC are the examples not existing. How can I move the PATH entry from C:\DB2 to C:\OtherPath\DB2 for example? Is it possible to do this db2cc.bat (db2javit)?

    Globe

  8. #8
    Join Date
    Apr 2012
    Posts
    1,035
    Provided Answers: 18
    Do not change the PATH or any DB2 settings unless you really know what you are doing.


    The V7 documentation is not on-line any more (too old).

    But the V8 documentation is on-line here:

    DB2 Universal Database

    You can see the JDBC samples in the V8 on-line documentation.

    The V8 samples for connecting to the database are like the V7 samples.

    When you open the above link, look in the "Contents" pane on the left side, then
    expand the topics with this path:


    (Contents)
    > + Samples
    > + Samples by functional area
    > + Database
    > + JDBC
    > + DBConn.java

  9. #9
    Join Date
    Jun 2012
    Posts
    13
    Thanks again.

    I have in the meantime tried some things. I have created a new database (db2cc.bat) and a table within. It does. My old database files are corrupt or not complete perharps!

    But I have found some backups and other files (I think). So there is a path within this are the

    Backups\DB2\NODE0000\CATN0000\20050122\170743.001

    Can I restore this database from this file? Is it a backup file from DB2?

    And then these below files:
    Backups\DATENPR\System\SQL00xxx.* (*.DAT, *.INX, *.LB) files
    Backups\DATENPR\Temp\SQLTAG.NAM
    Backups\DATENPR\User\SQL00xxx.* (*.DAT, *.INX, *.LB) files

    How can I from these files create the new healty database?

    Thanks,
    Globe

  10. #10
    Join Date
    Apr 2012
    Posts
    1,035
    Provided Answers: 18
    First try to see what is the state of the current database, before you try restoring anything.

    Please open a DB2CMD.EXE window again, and in there type
    db2 connect to _your_database_name user db2admin using _the_password_
    and what is the result ?

  11. #11
    Join Date
    Jun 2012
    Posts
    13
    Hi,

    the result is not good, is ambivalent!?

    db2 connect to DATENPR user db2admin using _the_password_
    SQL1403N The user-ID and/or password is/are wrong. SQLSTATE=08004

    Even the global password "DB2UDBPE" doesn't succeed. But I can see 3 of my databases with my password, but not 2 of the databases now. Yesterday I could even see the 2 databases!

    (

    Thanks,
    Globe

  12. #12
    Join Date
    Jun 2012
    Posts
    13
    And does DB2 use the Windows security userid and password? Because I have no password defined by this old PC for login.

    Globe

  13. #13
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    do not jump from one place to another - try to walk step-by-step and structured
    problem determination is even important as the solution
    in db2 command window :
    try to find the current instance
    db2 get instance
    are you locally logon to this machine with this user/ or db2admin
    find the instances - db
    db2ilist
    db2 list db directory
    try to connect without uid/pw
    db2 connect to dbname

    do not jump to restore before you identified all problems/errors
    always copy/paste the complete commands you type and the answer you get
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  14. #14
    Join Date
    Jun 2012
    Posts
    13
    You are right I am totally confused and try and try. Whole night/s.

    C:\Program Files\SQLLIB\bin>db2ilist
    DB2

    C:\Program Files\SQLLIB\bin>db2 list db directory
    ...
    Database 1:
    Alias name = DATENPR
    Database = DATENPR
    Drive = C:\DB2
    Release = 9.00
    Comment =
    Directory type = Indirekt
    Catalog node number = 0
    .....

    C:\Program Files\SQLLIB\bin>db2 connect to DATENPR
    Database connection information

    Database-Server = DB2/NT 7.1.0
    SQL-User-ID = DB2ADMIN
    Alias name of local database = DATENPR

    I must translate the outputs. I am using german version.

    Thanks a lot.

  15. #15
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    "And does DB2 use the Windows security userid and password? Because I have no password defined by this old PC for login"
    db2 is always using the os security : check in users/group to find the uid - you can set the pw also if you are the admin/local admin
    is there any problem left - any other issue ?
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

Posting Permissions

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