Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Posts
    78

    Unanswered: how to compile sqlj stored procedure

    Hello all,
    I 'am working in Windows DB2 v7.2
    I have the DB2 sample sqlj stored procedure: Stserver.sqlj and Stclient.sqlj calling Spserver.sqlj
    they are located under SQLLIB\samples\java

    The documentation tells that i can compile Spserver.sqlj with bldsqlj.bat which is also under that directory.

    Now, i have copied the necesary files: bldsqljs.bat , bldsqlj.bat, Stserver.sqlj, Stclient.sqlj,Stdrop.db2 and Stcreate.db2.

    I copied the above files under
    C:\Program Files\SQLLIB\java\java12\jdk\bin

    but when i try to run the bat, it gives the below errors:

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

    C:\Program Files\SQLLIB\java\java12\jdk\bin>bldsqljs Stserver
    Stserver.sqlj:143.8-144.58: Error: Left hand side of assignment does not have a
    Java type.
    Stserver.sqlj:151.8-151.50: Error: Invalid Java type for host item #1.
    Stserver.sqlj:151.8-151.50: Error: Cursor type in FETCH statement does not have
    a Java type.
    Stserver.sqlj:163.14-163.91: Error: Invalid Java type for host item #2.
    Stserver.sqlj:163.14-163.91: Error: Invalid Java type in cursor for WHERE CURREN
    T OF
    Stserver.sqlj:168.14-168.91: Error: Invalid Java type for host item #2.
    Stserver.sqlj:168.14-168.91: Error: Invalid Java type in cursor for WHERE CURREN
    T OF
    Stserver.sqlj:173.14-173.92: Error: Invalid Java type for host item #2.
    Stserver.sqlj:173.14-173.92: Error: Invalid Java type in cursor for WHERE CURREN
    T OF
    Stserver.sqlj:178.14-178.99: Error: Invalid Java type for host item #1.
    Stserver.sqlj:178.14-178.99: Error: Invalid Java type in cursor for WHERE CURREN
    T OF
    Stserver.sqlj:181.12-181.54: Error: Invalid Java type for host item #1.
    Stserver.sqlj:181.12-181.54: Error: Cursor type in FETCH statement does not have
    a Java type.
    Total 13 errors.
    Exception in thread "main" COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver] SQL1
    403N The username and/or password supplied is incorrect. SQLSTATE=08004

    at java.lang.Throwable.<init>(Throwable.java:96)
    at java.lang.Exception.<init>(Exception.java:44)
    at java.sql.SQLException.<init>(SQLException.java:45)
    at COM.ibm.db2.jdbc.DB2Exception.<init>(DB2Exception. java:94)
    at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_S QLException(SQLExce
    ptionGenerator.java:187)
    at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_r eturn_code(SQLExcep
    tionGenerator.java:432)
    at COM.ibm.db2.jdbc.app.DB2Connection.connect(DB2Conn ection.java(Compile
    d Code))
    at COM.ibm.db2.jdbc.app.DB2Connection.<init>(DB2Conne ction.java:389)
    at COM.ibm.db2.jdbc.app.DB2Driver.connect(DB2Driver.j ava:373)
    at java.sql.DriverManager.getConnection(DriverManager .java:459)
    at java.sql.DriverManager.getConnection(DriverManager .java:161)
    at COM.ibm.db2.sqlj.DB2SQLJInstaller.main(DB2SQLJInst aller.java:1275)
    Stserver*.class
    The system cannot find the file specified.
    0 file(s) copied.
    Stserver*.ser
    The system cannot find the file specified.
    0 file(s) copied.

    C:\Program Files\SQLLIB\java\java12\jdk\bin>
    ***************

    What can i do about it?Is there anything wrong with the directory i 'm working in??
    I can copy the bat file and the Stserver.sqlj file, but it is already an example file of DB2 's original samples.
    Can anybody (esp. who has successfully run these examples) help me?????

    thanks all, byes

  2. #2
    Join Date
    Dec 2003
    Posts
    78

    Unhappy

    hello,
    i got no replies, and i am stuck

    i 'm copying bldsqljs.bat and Strserver.sqlj below:
    what i did was to run
    C:\Program Files\SQLLIB\java\java12\jdk\bin>
    bldsqljs.bat Strserver.sqlj sampledb db2admin password
    when i got those messages

    *****bldsqljs.bat******begin****************
    @echo off
    rem (C) COPYRIGHT International Business Machines Corp. 1999, 2000
    rem All Rights Reserved.
    rem
    rem US Government Users Restricted Rights - Use, duplication or
    rem disclosure restricted by GSA ADP Schedule Contract with IBM Corp.

    rem Builds a Java embedded SQL (SQLJ) stored procedure
    rem Usage: bldsqljs prog_name [ db_name [ userid password ]]

    if "%1" == "" goto error

    rem Translate and compile the SQLJ source file
    rem and bind the package to the database.
    if "%2" == "" goto case1
    if "%3" == "" goto case2
    if "%4" == "" goto error
    goto case3
    :case1
    sqlj %1.sqlj
    db2profc -url=jdbc:db2:sample -prepoptions="package using %1" %1_SJProfile0
    goto continue
    :case2
    sqlj -url=jdbc:db2:%2 %1.sqlj
    db2profc -url=jdbc:db2:%2 -prepoptions="package using %1" %1_SJProfile0
    goto continue
    :case3
    sqlj -url=jdbc:db2:%2 -user=%3 -password=%4 %1.sqlj
    db2profc -url=jdbc:db2:%2 -user=%3 -password=%4 -prepoptions="package using %1" %1_SJProfile0
    goto continue
    :continue

    rem Copy the *.class and *.ser files to the 'function' directory.
    copy %1*.class "%DB2PATH%\function"
    copy %1*.ser "%DB2PATH%\function"

    goto exit

    :error
    echo Usage: bldsqljs prog_name [ db_name [ userid password ]]

    :exit

    @echo on

    *****bldsqljs.bat******end******************

  3. #3
    Join Date
    Dec 2003
    Posts
    78
    attached is Stserver.txt, text of SQLJ code
    It should be Stserver.sqlj to be compiles
    thanks all
    Attached Files Attached Files

Posting Permissions

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