Results 1 to 10 of 10
  1. #1
    Join Date
    Aug 2012
    Posts
    7

    Unanswered: During 1st run of below bat file on win7 machine for DB2 v9.7

    Hi...
    I have installed DB2 v9.7 on my win7 machine and trying to run following bat file..while running this file I am getting error
    (C:\applic\java\t05\clp>db2start
    SQL10007N Message "-1042" could not be retrieved. Reason code: "2".)


    db2start


    rem crea configurazione drda
    db2 -f drda.clp -td; -zt05db.log

    rem crea database t05
    db2 -ft05db.clp -td; -zt05db.log

    rem configura database t05
    db2 -ft05cf.clp -td; -zt05db.log

    rem crea backup database t05
    db2 -ft05bk.clp -td; -zt05db.log

    rem crea tabelle database t05
    db2 -ft05tb.clp -td; -zt05db.log

    rem crea utenza t05userX (X=1,2,3) e autorizzazioni
    db2 -ft05au.clp -td; -zt05db.log

    rem crea indici, chiavi e trigger sulle tabelle database t05
    db2 -ft05cs.clp -td: -zt05db.log
    db2 terminate




    Thanks in advance

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    What user are you running the batch file? What is in the db2diag.log?

    Andy

  3. #3
    Join Date
    Aug 2012
    Posts
    7
    Thanks ARWinner for your reply.

    User Name: PRamod (with administration right)

    And I am not able to find db2diag.log file...
    but I found a file name DB2.log.

    this file is having following detail
    ----------------------------------------------------------------
    Uninstall Log File opened 2012-07-27 16:05:17
    ----------------------------------------------------------------
    Uninstall cannot find any DB2 products installed on the system.
    ----------------------------------------------------------------
    Uninstall Log File closed 2012-07-27 16:05:19
    ----------------------------------------------------------------
    ----------------------------------------------------------------
    Uninstall Log File opened 2012-07-27 16:07:30
    ----------------------------------------------------------------
    Uninstall cannot find any DB2 products installed on the system.
    ----------------------------------------------------------------
    Uninstall Log File closed 2012-07-27 16:07:31
    ----------------------------------------------------------------


    I am using DB2 v9.7 on window 7 machine.

  4. #4
    Join Date
    Apr 2012
    Posts
    1,035
    Provided Answers: 18
    the db2diag.log lives on your DB2-server (not on the client).
    If your DB2-server is also on Windows-7 then the location of the db2diag.log is (by default) at c:\ProgramData\IBM\DB2\DB2COPY1\DB2
    But the default name and location can be changed by suitable configuration.
    You can also use the command db2diag -A to archive the current contents of the db2 diagnostics file, and that will also show you the full file name of the archived file.

  5. #5
    Join Date
    Aug 2012
    Posts
    7
    This problem got fixed...
    there was problem with the setup which I was using for DB2.
    with that setup I was not getting db2start.exe file in SQLLIB/BIN folder.

    once I got proper setup this problem got resolve.

  6. #6
    Join Date
    Aug 2012
    Posts
    7

    Not able to connect with Z/Os system using attched .bat file.

    I am taking backup of data from DB2 database into my personal windows 7 system.
    for that I am using a java setup.
    while running below .bat file I use to connect on windows XP machine and DB2 V7.

    @echo off
    db2start
    rem C:/WSAD50/runtimes/base_v5/java/jre/bin/java -cp db2java.zip;habeans.jar;t05.jar t05.MainWnd
    rem C:\java13\bin/java -cp db2java.zip;habeans.jar;t05.jar t05.MainWnd

    "C:\Program Files\IBM\Java60\jre\bin\javaw" -cp "C:\Program Files\IBM\SQLLIB\java\db2java.zip";t05.jar t05.MainWnd
    rem javaw -jar t05.jar



    But now I upgraded to Windows 7 and DB2 V9.7 and using same old java setup.
    I took the log of above file and got below result.

    SQL1026N The database manager is already active.

    Exception in thread "main" java.lang.UnsatisfiedLinkError: db2svc (.\db2svc.dll is not a valid Win32 application. )
    at java.lang.ClassLoader.loadLibraryWithPath(ClassLoa der.java:1011)
    at java.lang.ClassLoader.loadLibraryWithClassLoader(C lassLoader.java:975)
    at java.lang.System.loadLibrary(System.java:469)
    at db2svc.Db2Svc.<clinit>(Db2Svc.java)
    at java.lang.J9VMInternals.initializeImpl(Native Method)
    at java.lang.J9VMInternals.initialize(J9VMInternals.j ava:200)
    at t05.MainWnd.setDb2Svc(MainWnd.java)
    at t05.MainWnd.<init>(MainWnd.java)
    at t05.MainWnd.main(MainWnd.java)
    null



  7. #7
    Join Date
    Aug 2012
    Posts
    7

    Not able to connect with Z/Os system using attched .bat file.

    I am taking backup of data from DB2 database into my personal windows 7 system.
    for that I am using a java setup.
    while running below .bat file I use to connect on windows XP machine and DB2 V7.

    @echo off
    db2start
    rem C:/WSAD50/runtimes/base_v5/java/jre/bin/java -cp db2java.zip;habeans.jar;t05.jar t05.MainWnd
    rem C:\java13\bin/java -cp db2java.zip;habeans.jar;t05.jar t05.MainWnd

    "C:\Program Files\IBM\Java60\jre\bin\javaw" -cp "C:\Program Files\IBM\SQLLIB\java\db2java.zip";t05.jar t05.MainWnd
    rem javaw -jar t05.jar



    But now I upgraded to Windows 7 and DB2 V9.7 and using same old java setup.
    I took the log of above file and got below result.

    SQL1026N The database manager is already active.

    Exception in thread "main" java.lang.UnsatisfiedLinkError: db2svc (.\db2svc.dll is not a valid Win32 application. )
    at java.lang.ClassLoader.loadLibraryWithPath(ClassLoa der.java:1011)
    at java.lang.ClassLoader.loadLibraryWithClassLoader(C lassLoader.java:975)
    at java.lang.System.loadLibrary(System.java:469)
    at db2svc.Db2Svc.<clinit>(Db2Svc.java)
    at java.lang.J9VMInternals.initializeImpl(Native Method)
    at java.lang.J9VMInternals.initialize(J9VMInternals.j ava:200)
    at t05.MainWnd.setDb2Svc(MainWnd.java)
    at t05.MainWnd.<init>(MainWnd.java)
    at t05.MainWnd.main(MainWnd.java)
    null



  8. #8
    Join Date
    Apr 2012
    Posts
    1,035
    Provided Answers: 18
    What is db2svc.dll ?

  9. #9
    Join Date
    Aug 2012
    Posts
    7
    when I looked into db2svc file it's look like some load module of java code.I found an java code also with same name in setup. below I have pasted same java code.

    package db2svc;

    import java.util.*;
    import java.sql.*;

    public class Db2Svc
    {
    private Connection con = null;
    private Statement stm = null;
    private PreparedStatement pstm = null;
    private ResultSet rs = null;
    private String[] cols = {};
    private int[] types = {};
    private int[] sizes = {};
    private Vector rows = null;
    private ResultSetMetaData rsmd = null;

    static
    {
    try
    {
    System.loadLibrary("db2svc"); // load db2svc.dll
    }
    catch(Exception e)
    {
    System.out.println(e.getMessage());
    }
    }

    public native void backup(String sDb, String sUser, String sPassword, String sBackupDir) throws Exception;
    public void close() throws SQLException //, Throwable
    {
    if (pstm!=null)
    pstm.close();
    stm.close();
    con.close();
    // super.finalize();
    }
    public void commit() throws Exception
    {
    if (con == null)
    throw new Exception("There is no database to execute the statement");
    con.commit();
    }
    public native void delLog(String sDb) throws Exception;
    public void executeDynQuery(String query, Vector parms) throws Exception
    {
    if (con == null)
    throw new Exception("There is no database to execute the query");

    if (query==null)
    throw new Exception("Sql query not exists");

    pstm = con.prepareStatement(query);
    int i=1;
    for (Enumeration e = parms.elements() ; e.hasMoreElements(); i++)
    {
    pstm.setObject(i,e.nextElement());
    }
    rs = pstm.executeQuery();

    rsmd = rs.getMetaData();

    int numberOfColumns = rsmd.getColumnCount();
    cols = new String[numberOfColumns];
    types = new int[numberOfColumns];
    sizes = new int[numberOfColumns];
    // Get the column names and cache them.
    for(i = 0; i < numberOfColumns; i++)
    {
    cols[i] = rsmd.getColumnLabel(i+1);
    types[i] = rsmd.getColumnType(i+1);
    sizes[i] = rsmd.getColumnDisplaySize(i+1);
    }
    // Get all rows.
    rows=new Vector();
    while (rs.next())
    {
    Vector newRow = new Vector();
    String s = null;
    for (i = 1; i <= numberOfColumns; i++)
    {
    // istruzioni per trasformare la virgola in punto per i DECIMAL
    // poiche' il separatore dei decimali e' il punto
    if (rsmd.getColumnType(i)==Types.DECIMAL)
    {
    s=rs.getString(i);
    if (s != null)
    {
    if (s.indexOf(',')!=-1)
    s=s.replace(',','.');
    newRow.addElement(new java.math.BigDecimal(s));
    }
    else
    newRow.addElement(s); // s=null
    }
    else
    newRow.addElement(rs.getObject(i));
    }
    rows.addElement(newRow);
    }
    rs.close();
    }
    public void executeDynUpdate(String cmd, Vector values, Vector types) throws Exception
    {
    if (cmd==null)
    throw new Exception("Sql statement not exists");
    if (con == null)
    throw new Exception("There is no database to execute the statement");

    pstm = con.prepareStatement(cmd);
    for (Enumeration e=values.elements(); e.hasMoreElements()
    {
    Vector v = (Vector)(e.nextElement());
    for (int i=0; i<v.size() && i<types.size(); i++)
    {
    pstm.setObject(i+1,v.elementAt(i),((Integer)types. elementAt(i)).intValue());
    }
    pstm.executeUpdate();
    }
    }
    public void executeQuery(String query) throws Exception
    {
    if (con == null || stm == null)
    throw new Exception("There is no database to execute the query");

    if (query==null)
    throw new Exception("Sql query not exists");

    rs = stm.executeQuery(query);
    rsmd = rs.getMetaData();

    int numberOfColumns = rsmd.getColumnCount();
    cols = new String[numberOfColumns];
    types = new int[numberOfColumns];
    sizes = new int[numberOfColumns];
    // Get the column names and cache them.
    for(int i = 0; i < numberOfColumns; i++)
    {
    cols[i] = rsmd.getColumnLabel(i+1);
    types[i] = rsmd.getColumnType(i+1);
    sizes[i] = rsmd.getColumnDisplaySize(i+1);
    }
    // Get all rows.
    rows=new Vector();
    while (rs.next())
    {
    Vector newRow = new Vector();
    String s = null;
    for (int i = 1; i <= numberOfColumns; i++)
    {
    // istruzioni per trasformare la virgola in punto per i DECIMAL
    // poiche' il separatore dei decimali e' il punto
    if (rsmd.getColumnType(i)==Types.DECIMAL)
    {
    s=rs.getString(i);
    if (s != null)
    {
    if (s.indexOf(',')!=-1)
    s=s.replace(',','.');
    newRow.addElement(new java.math.BigDecimal(s));
    }
    else
    {
    newRow.addElement(s); // s=null
    }
    }
    else
    {
    newRow.addElement(rs.getObject(i));
    }
    }
    rows.addElement(newRow);
    }
    rs.close();
    }
    public int executeUpdate(String query) throws Exception
    {
    int iUpd=0;
    if (con == null || stm == null)
    throw new Exception("There is no database to execute the query");

    if (query==null)
    throw new Exception("Sql query not exists");

    iUpd=stm.executeUpdate(query);
    return iUpd;
    }
    public String[] getCols()
    {
    return cols;
    }
    public Connection getCon()
    {
    return con;
    }
    public Vector getRows()
    {
    return rows;
    }
    public int[] getSizes()
    {
    return sizes;
    }
    public int[] getTypes()
    {
    return types;
    }
    public void open(String url, String user, String password) throws Exception
    {
    con = DriverManager.getConnection(url, user, password);
    stm = con.createStatement();
    }
    public native void reorg() throws Exception;
    public native void restore(String sDb, String sUser, String sPassword, String sBackupDir) throws Exception;
    public void rollback() throws Exception
    {
    if (con == null)
    throw new Exception("There is no database to execute the statement");
    con.rollback();
    }
    public native void rollforward(String sDb, String sUser, String sPassword) throws Exception;
    public void setAutoCommit(boolean b) throws Exception
    {
    if (con == null)
    throw new Exception("There is no database to execute the statement");
    con.setAutoCommit(b);
    }
    public static void setDriver(String driver) throws Exception
    {
    Class.forName(driver);
    }
    }

  10. #10
    Join Date
    Apr 2012
    Posts
    1,035
    Provided Answers: 18
    Maybe you need to rebuild (and re-test) the db2svc.dll to work with the new version of the JVM that comes with the operating-system upgrade ?

    I hope you understand that your problem is not a problem with DB2 - you have a java / jvm issue. If you need more help, it is better if you ask on a Java forum. This forum is for DB2 issues, but you do not have a DB2 issue as far as I can see.

Posting Permissions

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