here's my .bat file to start the DB:
__________________
set JAVA_HOME=C:\Progra~2\Java\
set CLASSPATH=%JAVA_HOME%\lib\tools.jar;c:\h2\bin\h2-1.2.135.jar;c:
\h2\bin\lucene-core-3.0.2.jar
\progra~2\java\jre6\bin\java -cp "h2-1.2.135.jar;%H2DRIVERS%;%CLASSPATH
%" -Xincgc org.h2.tools.Server -tcp -tcpAllowOthers -web -
webAllowOthers
------------------------------
you can see I have the lucene jar on there, and I'm using H2 V135
here's my SQL: (note that the whole thing can be run over and over,
everything is cleared and recreated)
________________________
drop schema if exists magazine_index;
//this punts the full-text-search stuff
drop schema if exists FT;
drop schema if exists FTL;
CREATE SCHEMA magazine_index;
//this recreates FT
CREATE ALIAS IF NOT EXISTS FT_INIT FOR
"org.h2.fulltext.FullText.init";
CALL FT_INIT();
CREATE ALIAS IF NOT EXISTS FTL_INIT FOR
"org.h2.fulltext.FullTextLucene.init";
CALL FTL_INIT();
set schema magazine_index;
//do I need these table drops with the whole db drop above?
drop table issue_x_mag if exists;
drop table story_x_author if exists;
drop table story_x_photographer if exists;
drop table story_x_issue if exists;
drop table tag_x_story if exists;
drop table magazine if exists;
drop table tag if exists;
drop table issue if exists;
drop table author if exists;
drop table photographer if exists;
drop table story if exists;
drop table nmra_member if exists;
create table magazine (
mytime timestamp default current_timestamp(),
mag_id integer not null identity primary key,
name varchar(250)
);
//legitimate enterers of new data.
create table nmra_member (
mytime timestamp default current_timestamp(),
member_id integer not null identity primary key, //probably not
significant or valuable.
name varchar (200),
nmra_number integer, //verified with HQ.
entry_count integer default 0 //how many entries this person has
made.
);
create table issue (
mytime timestamp default current_timestamp(),
issue_id integer not null identity primary key,
mag_id integer,
// story foreign key (),
month varchar(30),
year integer,
constraint is1 foreign key (mag_id) references magazine(mag_id)
);
//needed?
create table issue_x_mag (
issue_id integer,
mag_id integer,
constraint im1 foreign key (issue_id) references issue
(issue_id),
constraint im2 foreign key (mag_id) references magazine
(mag_id)
);
create table author (
mytime timestamp default current_timestamp(),
auth_ID integer not null identity primary key,
name varchar(150)
);
create table story (
mytime timestamp default current_timestamp(),
story_id integer not null identity primary key,
title varchar(250),
page integer
);
create table photographer (
mytime timestamp default current_timestamp(),
photog_id integer not null identity primary key,
name varchar(150)
);
create table tag (
mytime timestamp default current_timestamp(),
tag_id integer not null identity primary key,
name varchar(30)
);
create table tag_x_story (
mytime timestamp default current_timestamp(),
tag_id integer,
story_id integer,
constraint ts1 foreign key (tag_id) references tag(tag_id),
constraint ts2 foreign key (story_id) references
story(story_id)
);
//because a story could have multiple authors
create table story_x_author (
auth_id integer,
story_id integer,
constraint sa1 foreign key (auth_ID) references author
(auth_ID),
constraint sa2 foreign key (story_id) references story
(story_id)
);
//because a story could have multiple photographers
create table story_x_photographer (
photog_id integer,
story_id integer,
constraint sp1 foreign key (photog_ID) references photographer
(photog_id),
constraint sp2 foreign key (story_id) references story
(story_id)
);
//because an issue has multiple stories
create table story_x_issue (
issue_id integer,
story_id integer,
constraint si1 foreign key (issue_ID) references issue
(issue_id),
constraint si2 foreign key (story_id) references story
(story_id)
);
create table errors (
mytime timestamp default current_timestamp(),
error_id integer not null identity primary key,
description varchar(2000)
);
create index story_x_author_index1 on story_x_author(auth_id);
create index story_x_author_index2 on story_x_author(story_id);
create index story_x_issue_index1 on story_x_issue(story_id);
create index story_x_issue_index2 on story_x_issue(issue_id);
create index story_index on story(story_id);
create index author_index on author(auth_id);
//do these have to run AFTER putting some data in? and then run again
and again?
CALL FT_CREATE_INDEX('MAGAZINE_INDEX', 'STORY', 'TITLE' );
CALL FT_CREATE_INDEX('MAGAZINE_INDEX', 'AUTHOR', 'NAME');
CALL FT_CREATE_INDEX('MAGAZINE_INDEX', 'TAG', 'NAME');
CALL FT_CREATE_INDEX('MAGAZINE_INDEX', 'PHOTOGRAPHER', 'NAME');
CALL FTL_CREATE_INDEX('MAGAZINE_INDEX', 'STORY', 'TITLE' );
CALL FTL_CREATE_INDEX('MAGAZINE_INDEX', 'AUTHOR', 'NAME');
CALL FTL_CREATE_INDEX('MAGAZINE_INDEX', 'TAG', 'NAME');
CALL FTL_CREATE_INDEX('MAGAZINE_INDEX', 'PHOTOGRAPHER', 'NAME');
insert into magazine(name) values ('Model Railroader');
insert into magazine(name) values ('1:87 Scale');
insert into magazine(name) values ('30 Guild');
insert into magazine(name) values ('On30 Interchange');
insert into magazine(name) values ('Big Train Operator');
insert into magazine(name) values ('Brass Browser');
insert into magazine(name) values ('Brass Buyers Guide');
insert into magazine(name) values ('Brass Modeler and Collector');
insert into magazine(name) values ('Canadian Railway Modeler');
insert into magazine(name) values ('Classic Toy Trains');
insert into magazine(name) values ('Garden Railways');
insert into magazine(name) values ('Live Steam');
insert into magazine(name) values ('Grand Scales Quarterly');
insert into magazine(name) values ('Greater Tinplater');
insert into magazine(name) values ('Great Model Railroads');
insert into magazine(name) values ('HO Model Trains');
insert into magazine(name) values ('Model Trains');
insert into magazine(name) values ('Clear Block');
insert into magazine(name) values ('Colorado Narrow Gauge Quarterly');
insert into magazine(name) values ('Dispatchers Office');
insert into magazine(name) values ('Finelines');
insert into magazine(name) values ('Finescale Railroader');
insert into magazine(name) values ('Outdoor RR');
insert into magazine(name) values ('Inside Track');
insert into magazine(name) values ('LGB Telegram');
insert into magazine(name) values ('Light Iron Digest');
insert into magazine(name) values ('Lion Roars');
insert into magazine(name) values ('Maine 2-foot Quarterly');
insert into magazine(name) values ('Mainline Modeler');
insert into magazine(name) values ('Miniature Locomotive');
insert into magazine(name) values ('Miniature Railroading');
insert into magazine(name) values ('Model Builder');
insert into magazine(name) values ('Modelmaker Magazine');
insert into magazine(name) values ('Model Rail News');
insert into magazine(name) values ('Model Railroad Planning');
insert into magazine(name) values ('Model Railroad Collector');
insert into magazine(name) values ('Model Railroading');
insert into magazine(name) values ('1001 Model Railroading Ideas');
insert into magazine(name) values ('Great World of Model
Railroading');
insert into magazine(name) values ('Modeltec');
insert into magazine(name) values ('Model Transport');
insert into magazine(name) values ('MRCS Dispatch');
insert into magazine(name) values ('N Scale');
insert into magazine(name) values ('N Scale Railroading');
insert into magazine(name) values ('N-TRAK Newsletter');
insert into magazine(name) values ('Narrow Gauge and Short Line
Gazette');
insert into magazine(name) values ('NASG Dispatch');
insert into magazine(name) values ('NER Coupler');
insert into magazine(name) values ('North American Live Steamer');
insert into magazine(name) values ('NMRA Bulletin');
insert into magazine(name) values ('Scale Rails');
insert into magazine(name) values ('O Gager');
insert into magazine(name) values ('O Gauge Modeler');
insert into magazine(name) values ('O Scale');
insert into magazine(name) values ('O Gauge Railroading');
insert into magazine(name) values ('O Scale News');
insert into magazine(name) values ('O Scale Trains');
insert into magazine(name) values ('Prototype Modeler');
insert into magazine(name) values ('Railmodel Journal');
insert into magazine(name) values ('Railmodel Magazine');
insert into magazine(name) values ('Railroad Model Craftsman');
insert into magazine(name) values ('Railroad Modeler');
insert into magazine(name) values ('S Gaugian');
insert into magazine(name) values ('Scale Coupler');
insert into magazine(name) values ('Scale Steam Pictorial');
insert into magazine(name) values ('Slim Gauge News');
insert into magazine(name) values ('Sn3 Modeler');
insert into magazine(name) values ('Steam in the Garden');
insert into magazine(name) values ('Toy Trains');
insert into magazine(name) values ('Western Prototype Modeler');
insert into magazine(name) values ('S Gauge Herald');
insert into magazine(name) values ('Whistle Stop');
insert into magazine(name) values ('O Gauge Modeler');
insert into magazine(name) values ('TTOS Bulletin');
insert into magazine(name) values ('Switcher');
insert into magazine(name) values ('Model Railroad Equipment Buyers
Guide');
insert into magazine(name) values ('Rail Line News');
insert into magazine(name) values ('Rail Protomodels');
insert into magazine(name) values ('S/Sn3 Buyers/Modeling Guide');
insert into magazine(name) values ('Toy and Train Album');
insert into magazine(name) values ('Toy and Model Trains');
insert into magazine(name) values ('Train Collectors Quarterly');
insert into magazine(name) values ('Delaware Valley/Atlantic Division
Express');
insert into magazine(name) values ('Turntable');
insert into magazine(name) values ('Yard Limits');
insert into story(title, page) values ('Test Story', 23);
insert into author (name) values ('Clint Hyde');
insert into issue(month, year, mag_id) values ('January', 1995, 1);
insert into author (name) values ('Bill Smith');
insert into story(title, page) values ('Review', 74);
insert into issue(month, year, mag_id) values ('August', 2004, 1);
insert into story_x_author(auth_id, story_id) values (1,1);
insert into story_x_author(auth_id, story_id) values (2,2);
insert into story_x_issue(issue_id, story_id) values (1,1);
insert into story_x_issue(issue_id, story_id) values (2,2);
insert into issue_x_mag(issue_id, mag_id) values (1,1);
insert into issue_x_mag(issue_id, mag_id) values (2,1);
select * from magazine;
select * from story;
select * from author;
select * from issue;
select * from issue_x_mag;
select * from story_x_issue;
select * from story_x_author;
select
magazine.name, issue.month, issue.year, story.title,
author.name
from story, author, story_x_author, story_x_issue, issue,
issue_X_mag, magazine
where story_x_issue.story_id = story.story_id
and story_x_issue.issue_id = issue.issue_id
and story.story_id = story_x_author.story_id
and story_x_author.auth_id = author.auth_id
and issue_x_mag.issue_id = issue.issue_id
and issue_x_mag.mag_id = magazine.mag_id;
select * from ft_search_Data('clint', 0, 0);
______________________________
here's the first error msg from H2 [running the exact sql above!]
running on Win 7:
CREATE ALIAS IF NOT EXISTS FTL_INIT FOR
"org.h2.fulltext.FullTextLucene.init";
Update count: 0
(0 ms)
CALL FTL_INIT();
Exception calling user-defined function: "init(conn24:
url=jdbc:default:connection user=SA):
org.apache.lucene.index.IndexReader.indexExists(Ljava/lang/String;)Z";
SQL statement:
CALL FTL_INIT() [90105-135] 90105/90105 (Help)
org.h2.jdbc.JdbcSQLException: Exception calling user-defined function:
"init(conn24: url=jdbc:default:connection user=SA):
org.apache.lucene.index.IndexReader.indexExists(Ljava/lang/String;)Z";
SQL statement:
CALL FTL_INIT() [90105-135]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:
327)
at org.h2.message.DbException.get(DbException.java:156)
at org.h2.message.DbException.convertInvocation(DbException.java:
295)
at org.h2.engine.FunctionAlias
$JavaMethod.getValue(FunctionAlias.java:395)
at org.h2.expression.JavaFunction.getValue(JavaFunction.java:36)
at org.h2.command.dml.Call.query(Call.java:61)
at org.h2.command.CommandContainer.query(CommandContainer.java:80)
at org.h2.command.Command.executeQuery(Command.java:132)
at org.h2.server.TcpServerThread.process(TcpServerThread.java:275)
at org.h2.server.TcpServerThread.run(TcpServerThread.java:134)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoSuchMethodError:
org.apache.lucene.index.IndexReader.indexExists(Ljava/lang/String;)Z
at
org.h2.fulltext.FullTextLucene.getIndexModifier(FullTextLucene.java:
262)
at org.h2.fulltext.FullTextLucene.init(FullTextLucene.java:101)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.h2.engine.FunctionAlias
$JavaMethod.getValue(FunctionAlias.java:383)
... 7 more
at org.h2.engine.SessionRemote.done(SessionRemote.java:528)
at org.h2.command.CommandRemote.executeQuery(CommandRemote.java:
158)
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:
172)
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:151)
at org.h2.server.web.WebApp.getResult(WebApp.java:1300)
at org.h2.server.web.WebApp.query(WebApp.java:1001)
at org.h2.server.web.WebApp$1.next(WebApp.java:965)
at org.h2.server.web.WebApp$1.next(WebApp.java:968)
at org.h2.server.web.WebThread.process(WebThread.java:161)
at org.h2.server.web.WebThread.run(WebThread.java:88)
at java.lang.Thread.run(Unknown Source)
________________________
yesterday I rebooted my Win 7 PC. Now it appears that the internal
text search is going to work...but it still complains about lucene...
and no matter what, this seems not to run on my friend's server, which
is where I need it to end up, so that it's on the web.
-- clint
On Aug 11, 4:45 pm, Kerry Sainsbury <
ke...@fidelma.com> wrote:
> Hi Clint,
>
> Maybe you could provide the specific steps you are following so we could
> perhaps reproduce the problem? What version of H2 are you using?
>
> Also, what do you mean specifically by "lucene is worse...that doesn't work
> anywhere" -- do you have actual error messages?
>
> Thanks
> Kerry
>