cancel
Showing results for 
Search instead for 
Did you mean: 

Why the number of rows affected is zero?

Former Member
0 Kudos

Spring application works with database Sybase ASE.

Environment: jdk 1.7.0_80, spring 4.2.3.RELEASE,

Sybase ASE : TEST = Adaptive Server Enterprise/12.5.4/EBF 16800 ESD#10/ase1254/2159/64-bit

PRODUCTION = Adaptive Server Enterprise/15.5/EBF 19399 SMP ESD#5/asear155/2568/64-bit

JConnection: jconn3.jar and jconn4.jar

This code work with database:

import javax.sql.DataSource;

import java.sql.Connection;

import java.sql.PreparedStatement;

import java.sql.SQLException;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.beans.factory.annotation.Qualifier;

import org.springframework.transaction.annotation.Propagation;

import org.springframework.transaction.annotation.Transactional;

@Repository("DAO")

public class DAO {

@Autowired

@Qualifier("dataSource")

private DataSource dataSource;

@Autowired private JdbcTemplate jdbcTemplate;

public void setDataSource(DataSource dataSource)

{

this.dataSource = dataSource;

this.jdbcTemplate = new JdbcTemplate(dataSource);

}

public void commit1(String value) {

int rows = jdbcTemplate.update("UPDATE TABLE SET COLUMN_1 = GETDATE()

WHERE COLUMN_1 = ?", value);

System.out.println("rows = " + rows);

}

public void commit2(String value) {

Integer count = -1;

try {

Connection con = null;

PreparedStatement ps = null;

try {

con = dataSource.getConnection();

ps = con.prepareStatement("UPDATE TABLE SET COLUMN_1 = GETDATE()

WHERE COLUMN_1 = ?");

ps.setString(1, value);

count = ps.executeUpdate();

System.out.println("rows = " + rows);

}

finally {

if (ps != null) ps.close();

if (con != null) con.close();

} } catch (SQLException ex) { }

}

}

Problem in PRODUCTION :

execute method commit1(value) OR commit2(value)

In fact I update several rows but with jconn4 library I get next results(console):

rows = 0


with jconn3 library I get next (correct) results:

rows = correct result (1 or more )

in TEST environment with jconn3 and jconn4 library methods work correct:

rows = correct result (1 or more )

How to fix this problem?

Accepted Solutions (0)

Answers (2)

Answers (2)

alberto_merino
Discoverer
0 Kudos

I found KBA 2286329 - What SAP ASE releases have a fix for CR 669482 ?. Check KBA that although it is not exactly the same issue it suggests that upgrading ASE and also SDK to 15.7 SP139 might help. Otherwise open an incident with us.

Former Member
0 Kudos

Sap corporation did not give answe

former_member188958
Active Contributor
0 Kudos

Did you open a support incident with SAP?