Since it is an identity column it is automatically incremented.
Here is the Dialect file and the UrlConnectionSource.MSSQL_PART constant. It appears the other places a Dialect are mentioned are simple enough that they might not need to be specifically listed. Do you need anything else?
***************************************** Begin MsSqlDialect.java
/*
* Copyright 1999,2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.log4j.db.dialect;
/**
* The MS SQL Server dialect is untested.
*
* @author James Stauffer
*/
public class MsSqlDialect implements SQLDialect {
public static final String SELECT_CURRVAL = "SELECT @@identity id";
public String getSelectInsertId() {
return SELECT_CURRVAL;
}
}
********************************************** end file
UrlConnectionSource.MSSQL_PART = "mssqlserver4";
James Stauffer
-----Original Message-----
From: Ceki Gülcü [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 18, 2004 10:20 AM
To: Log4J Developers List
Subject: RE: DBAppender (1.3) schema for MS SQL Server
You need to add a dialect constant in ConenctionSource and add support for
the MS SQL dialect in the various connection source implementations.
How is the logging_event.event_id field set/incremented?
At 05:11 PM 5/18/2004, you wrote:
>I understand that a dialect hasn't been written yet, but the followind
>schema should work. I tried it (with my own DBAppender that expects the
>same schema as the official DBAppender) and it seemed to work fine. In
>order to support MS SQL Server is the only other thing needed a
>dialect? If yes, then I'll take a stab at it.
>
>Note that BIGINT wasn't supported so I used DECIMAL(20) instead.
>
>-- This SQL script creates the required tables by
>org.apache.log4j.db.DBAppender and
>-- org.apache.log4j.db.DBReceiver.
>--
>-- It is intended for MS SQL Server databases. This has been tested with
>version 7.0.
>
>DROP TABLE logging_event_property
>DROP TABLE logging_event_exception
>DROP TABLE logging_event
>
>CREATE TABLE logging_event
> (
> sequence_number DECIMAL(20) NOT NULL,
> timestamp DECIMAL(20) NOT NULL,
> rendered_message TEXT NOT NULL,
> logger_name VARCHAR(254) NOT NULL,
> level_string VARCHAR(254) NOT NULL,
> ndc TEXT,
> thread_name VARCHAR(254),
> reference_flag SMALLINT,
> event_id INT NOT NULL identity,
> PRIMARY KEY(event_id)
> )
>
>CREATE TABLE logging_event_property
> (
> event_id INT NOT NULL,
> mapped_key VARCHAR(254) NOT NULL,
> mapped_value TEXT,
> PRIMARY KEY(event_id, mapped_key),
> FOREIGN KEY (event_id) REFERENCES logging_event(event_id)
> )
>
>CREATE TABLE logging_event_exception
> (
> event_id INT NOT NULL,
> i SMALLINT NOT NULL,
> trace_line VARCHAR(254) NOT NULL,
> PRIMARY KEY(event_id, i),
> FOREIGN KEY (event_id) REFERENCES logging_event(event_id)
> )
>
>James Stauffer
>
>-----Original Message-----
>From: James Stauffer
>[<mailto:[EMAIL PROTECTED]>mailto:[EMAIL PROTECTED]]
>Sent: Monday, May 17, 2004 12:18 PM
>To: '[EMAIL PROTECTED]'
>Subject: DBAppender (1.3) schema for MS SQL Server
>
>Does anyone have DBAppender (1.3) schema for MS SQL Server? I could do
>it
>but I am currently waiting for tools to access an MS SQL Server.
>
>James Stauffer
--
Ceki Gülcü
For log4j documentation consider "The complete log4j manual"
ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]