Results 1 to 2 of 2

Thread: JDBC problem

  1. #1
    Join Date
    Mar 2004
    Posts
    1

    Unanswered: JDBC problem

    Hello,
    I am having some hard times getting the very simple code up and runing. I am using DB2 8.1 (under WinXP) and I am trying to connect the database via JDBC. (db2cc.jar with db2jcc_license_cu.jar)

    This is the piece of code I am trying to run:


    DriverManager.registerDriver(new com.ibm.db2.jcc.DB2Driver());
    Connection conn = DriverManager.getConnection(url, user, password);

    final String QUERY = "SELECT * FROM USER";

    Statement select = conn.createStatement();
    ResultSet result = select.executeQuery(QUERY);

    And this is the result I get:

    com.ibm.db2.jcc.a.SqlException: DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: LOCALUSER.USER


    LOCALUSER is an authorised user. USER is a name of a table in the database I am trying to access.

    Does anyone have an idea what might be wrong?

    Thank you.

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1

    Re: JDBC problem

    Originally posted by sverrir
    Hello,
    I am having some hard times getting the very simple code up and runing. I am using DB2 8.1 (under WinXP) and I am trying to connect the database via JDBC. (db2cc.jar with db2jcc_license_cu.jar)

    This is the piece of code I am trying to run:


    DriverManager.registerDriver(new com.ibm.db2.jcc.DB2Driver());
    Connection conn = DriverManager.getConnection(url, user, password);

    final String QUERY = "SELECT * FROM USER";

    Statement select = conn.createStatement();
    ResultSet result = select.executeQuery(QUERY);

    And this is the result I get:

    com.ibm.db2.jcc.a.SqlException: DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: LOCALUSER.USER


    LOCALUSER is an authorised user. USER is a name of a table in the database I am trying to access.

    Does anyone have an idea what might be wrong?

    Thank you.
    Looks like the USER table is not in the LOCALUSER schema... Try using fully a qualified table name in your query.

Posting Permissions

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