Archive

Archive for the ‘java’ Category

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

January 5th, 2007

- 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: ,

pjdc java

Retrieving identity column values from MS SQL Server by JDBC

January 3rd, 2007

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:

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

or

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

2. Get the generated values from the statement

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

Technorati Tags: , ,

pjdc database, java ,