You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by James Stauffer <js...@spscommerce.com> on 2004/05/18 17:11:55 UTC
RE: DBAppender (1.3) schema for MS SQL Server
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:jstauffe@spscommerce.com]
Sent: Monday, May 17, 2004 12:18 PM
To: 'log4j-user@jakarta.apache.org'
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
RE: DBAppender (1.3) schema for MS SQL Server
Posted by Ceki Gülcü <ce...@qos.ch>.
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
>[<ma...@spscommerce.com>mailto:jstauffe@spscommerce.com]
>Sent: Monday, May 17, 2004 12:18 PM
>To: 'log4j-user@jakarta.apache.org'
>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: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org