work with sybase...

Discussion in 'Java' started by Bumsys@gmail.com, May 13, 2008.

  1. Guest

    I run sql query:
    public final void insertFileSybase(final int id, final String folder,
    final String filename, final File file, final boolean
    isPacked,
    final Timestamp lastModified, final Timestamp lastWritten,
    final String checkSum, final int backupNo, final int type,
    final boolean isDeleted, final int clientId)
    throws SQLException, IOException {
    // TODO checksum is null
    boolean isAUResChecksumColumnExist =
    manager.getConnectionInfo()
    .isAUResChecksumColumnExist();

    int deleted = isDeleted ? 1 : 0;

    String query = null;
    if (isAUResChecksumColumnExist) {
    query = "insert into "
    + getFullTableName(Tables.RESOURCE)
    + " (application_id, backupno, path, name,
    contents, last_written, last_modified, packed, checksum, type,
    deleted, client_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
    } else {
    query = "insert into "
    + getFullTableName(Tables.RESOURCE)
    + " (application_id, backupno, path, name,
    contents, last_written, last_modified, packed, type, deleted,
    client_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
    }
    logQuery(query);
    logQueryParameter("application_id = " + id);
    logQueryParameter("backupno = " + backupNo);
    logQueryParameter("path = " + makePathToDB(folder));
    logQueryParameter("name = " + filename);
    logQueryParameter("last_written = " + lastWritten);
    logQueryParameter("last_modified = " + lastModified);
    logQueryParameter("packed = " + (isPacked ? 1 : 0));
    if (isAUResChecksumColumnExist) {
    logQueryParameter("checkSum = " + checkSum);
    }
    logQueryParameter("type = " + type);
    logQueryParameter("deleted = " + deleted);
    logQueryParameter("client_id = " + clientId);
    PreparedStatement ps =
    manager.getConnection().prepareStatement(query);
    ps.setInt(1, id);
    ps.setInt(2, backupNo);
    ps.setString(3, makePathToDB(folder));
    ps.setString(4, filename);

    // TODO long
    int len = (int) file.length();
    log.info("file: " + file.getAbsolutePath());
    if (isDeleted && !file.exists()) {
    ps.setNull(5, Types.LONGVARBINARY);
    } else if (file.exists() && len == 0) {
    ps.setNull(5, Types.LONGVARBINARY);
    } else {
    InputStream in = new FileInputStream(file);
    ps.setBinaryStream(5, in, len);
    }

    ps.setTimestamp(6, lastWritten);
    ps.setTimestamp(7, lastModified);
    ps.setInt(8, isPacked ? 1 : 0);
    if (isAUResChecksumColumnExist) {
    ps.setString(9, checkSum);
    }
    int typeNumber = isAUResChecksumColumnExist ? 10 : 9;
    ps.setInt(typeNumber, type);
    int deletedNumber = isAUResChecksumColumnExist ? 11 : 10;
    ps.setInt(deletedNumber, deleted);
    int clientIdNumber = isAUResChecksumColumnExist ? 12 : 11;
    ps.setInt(clientIdNumber, clientId);

    int numberOfRows = ps.executeUpdate();
    logNumberOfRows(numberOfRows);
    ps.close();
    }

    and when run ps.executeUpdate(), i.e. run sql query and then I have
    error: There is not enough procedure cache to run this procedure,
    trigger, or
    SQL batch. Retry later, or ask your SA to reconfigure ASE with more
    procedure cache.
    What can do that to solve this problem?
    , May 13, 2008
    #1
    1. Advertising

  2. Tim Slattery Guest

    wrote:

    >and when run ps.executeUpdate(), i.e. run sql query and then I have
    >error: There is not enough procedure cache to run this procedure,
    >trigger, or
    >SQL batch. Retry later, or ask your SA to reconfigure ASE with more
    >procedure cache.
    >What can do that to solve this problem?


    Sounds like a message that Sybase sent in response to your query.
    You'll have to work with your database administrator to get the DB
    configured correctly.

    --
    Tim Slattery

    http://members.cox.net/slatteryt
    Tim Slattery, May 13, 2008
    #2
    1. Advertising

  3. Arne Vajhøj Guest

    wrote:
    > I run sql query:


    > if (isAUResChecksumColumnExist) {
    > query = "insert into "
    > + getFullTableName(Tables.RESOURCE)
    > + " (application_id, backupno, path, name,
    > contents, last_written, last_modified, packed, checksum, type,
    > deleted, client_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
    > } else {
    > query = "insert into "
    > + getFullTableName(Tables.RESOURCE)
    > + " (application_id, backupno, path, name,
    > contents, last_written, last_modified, packed, type, deleted,
    > client_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
    > }


    > int numberOfRows = ps.executeUpdate();
    > logNumberOfRows(numberOfRows);
    > ps.close();
    > }
    >
    > and when run ps.executeUpdate(), i.e. run sql query and then I have
    > error: There is not enough procedure cache to run this procedure,
    > trigger, or
    > SQL batch. Retry later, or ask your SA to reconfigure ASE with more
    > procedure cache.
    > What can do that to solve this problem?


    The errors text is rather clear.

    Sybase need to be reconfigured with more procedure cache.

    If you ask the DBA he/she should know what it is. And it
    need the be fixed - the database is fubar as is.

    I am a bit puzzled because you are using straight insert and
    not a SP, but maybe there is an insert trigger on the table.

    Arne
    Arne Vajhøj, May 15, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vince

    DBD::Sybase install errors

    Vince, Aug 22, 2003, in forum: Perl
    Replies:
    0
    Views:
    1,376
    Vince
    Aug 22, 2003
  2. Vicky
    Replies:
    0
    Views:
    762
    Vicky
    Jul 6, 2004
  3. Shawn

    displaying sybase timestamp

    Shawn, Jan 27, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    3,137
    Shawn
    Jan 27, 2004
  4. Shawn

    Saving image to Sybase

    Shawn, Feb 19, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    4,698
    Shawn
    Feb 20, 2004
  5. Eric Briffoz via DotNetMonster.com

    Sybase Datawindow in ASP .NET ?

    Eric Briffoz via DotNetMonster.com, Feb 1, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    561
    Eric Briffoz via DotNetMonster.com
    Feb 1, 2005
Loading...

Share This Page