How To … Rotating Header Image

Implement pagination with SQL Server 2005

With the new row_number() feature of the MS SQL Server 2005, now it’s very easy to implement pagination: get data rows page by page to avoid the retrieve too much data at same time. The new feature it’s very similar to the Oracle ROWUM.
The prepare statement could be like the follow:

SELECT * FROM ( SELECT row_number() OVER (ORDER BY id) as resultNum, id FROM table_name) as numberResultsWHERE resultNum  BETWEEN ? AND ?

More information here.

Technorati Tags: ,

Error: no `server’ JVM at … jvm.dll

- remove the -server parameter from your command line, or
- download de Java JDK. The JVM server configuration DLL are not included in the JRE.

Technorati Tags: ,

Retrieving identity column values from MS SQL Server by JDBC

Retrieving identity column values in JDBC applications:

You define an identity column in a CREATE TABLE by specifying the IDENTITY clause when you define a column.
This feature is defined in the JDBC, and implmented in the MS Sql Server 2005, not in the older version. For Oracle database this is not implemented, but the common solution of the rownum can be used instead.

1.Set the prepared statement to get the identity column from DB:

Connection.prepareStatement(sql-statement,
Statement.RETURN_GENERATED_KEYS);

or

Statement.executeUpdate(sql-statement, Statement.RETURN_GENERATED_KEYS);

2. Get the generated values from the statement

rs = stmt.getGeneratedKeys();
while (rs.next()) {
rs.getBigDecimal(1);
}

Technorati Tags: , ,

List the open ports on a windows machine

run netstat -a

Hello world!

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!

Technorati Profile Testing the source code box:

function hello_world(){ echo "hello world" }