[h2] Does H2's built in connection pool work with other JDBC dbs?

2020-11-14 Thread Adam McMahon
Hi,

Does H2's built in connection pool work with other JDBC databases?  I am 
specifically talking about org.h2.jdbcx.JdbcConnectionPool?

I assumed it would work with any JDBC database, but I could not get it to 
work with MYSQL

Thanks,

-Adam

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/cb5ecdd0-3fa4-47d6-993e-b77164ee929an%40googlegroups.com.


[h2] Connecting remotely to H2

2019-01-02 Thread Adam McMahon
Start h2 in server mode. 

Connect to the h2 server in java using the jdbc. Look at the url jdbc examples 
to connect to a server. 
Use normal jdbc to query the database. 

Adam

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Re: autocommit=false slower than autocommit=true??

2018-12-04 Thread Adam McMahon
Andrei,

Thanks for the information that autocomiit=false is not expected to be 
slower.  I looked closer at my application code and there seemed to be an 
unrelated problem in my application code that was causing the issue.  So, 
the error was on my side.  I am now getting expected performance.

Best,

-Adam



On Sunday, December 2, 2018 at 8:11:31 PM UTC-5, Andrei Tokar wrote:
>
> No, performance suppose to be the same, if not faster, if you batch is not 
> big. How do you measure it? what is the version you are using, and how url 
> is look like? Can you produce standalone use case demonstrating slowness.
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] autocommit=false slower than autocommit=true??

2018-12-01 Thread Adam McMahon
Hi,

I have a need to batch together a number of inserts/updates into a single 
transaction.  I am using autocomit=false to make them a single transaction 
and then call commit() at the end.  When I do this, the performance drops 
significantly (about 10-15 times slower) as opposed to doing each 
insert/update individually with autocomit=true.  Is this expected behavior?

-Adam

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] order of operations in a where cluase

2018-10-18 Thread Adam McMahon
Hi group,

I have a user defined function MyF which is pretty slow.  In a where 
clause, I would like MyF to be run last.

example

select * from users where age>10 AND weight>100 AND MyF(data)==true

considering MyF is slow, I only want it to run if it first passes the 
initial conditions (which should be fast).  I assume H2 will stop checking 
conditions once there is a single false.  Is there any way to guarantee 
that the user defined function is called last?

-Adam

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Define a limit size for a table

2018-06-07 Thread Adam McMahon
You can easily handle this at the application level by checking the size of 
table before insert. 

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Re: embedded server (like derby?)

2018-06-05 Thread Adam McMahon
Hi,

Thanks that is exactly what I was looking for.  Perhaps I should have tried 
that before I asked my question.

That being said, is this fact mentioned in the docs on the H2 site (I did 
not see it).  If it is not mentioned I think it would be good to add a 
section about this. This embedded server w/ local connections is a great 
feature that is helpful when deciding how to use H2.

Best,

-Adam



On Monday, June 4, 2018 at 3:28:31 AM UTC-4, Evgenij Ryazanov wrote:
>
> Hello.
>
> If you start a H2 Server in your application with 
> Server.createTcpServer(optional_parameters).start();
> you can connect to database from the same process using local URLs and 
> remotely with remote URLs.
>
> If you don't care which application will use the database directly and all 
> of them have access to database file (because all processes are launched on 
> the same computer or database is located on network filesystem) you can use 
> an automatic mixed mode instead:
> http://www.h2database.com/html/features.html#auto_mixed_mode
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] embedded server (like derby?)

2018-06-04 Thread Adam McMahon
Hi H2 Group,

Derby has a mode called "embedded server".  In this mode, Derby accepts 
embedded connecions internally within the same JVM and also external 
connections via the network server protocol.

Is there something similar to this in H2?

Best,

-Adam

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Re: How to import a .db file into h2 database?

2018-03-18 Thread Adam McMahon
Hi,

You can put the h2 db files wherever you want.  in the h2 web console, 
point to the h2 db files in the *JDBC Url*.  Look at this link on how to 
format the url to reference your file: 

http://www.h2database.com/html/features.html#database_url

You will likely want a url for an embedded connection from the h2 consle, 
that follows the pattern for a file based embedded connection:  
http://www.h2database.com/html/features.html#embedded_databases

You may also need to put the user name and password into the web console, 
if you have it.

-Adam

On Friday, March 16, 2018 at 3:55:03 AM UTC-4, Jian Zhang wrote:
>
> Hi,
>
> I have a .db file and I don't know how to import into the h2 database 
> since I'm new to this database engine. I have not found any useful 
> instructions yet.  Does someone know how to do with it?
>
> Thanks,
> Jian
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] mvstore api vs berkeleydb JE?

2018-03-16 Thread Adam McMahon
Hi,

I am looking for an embeddable key-value store.  MVStore and Berkeley DBJE 
seem to be nice fits.  Aside from the licensing differences, are there any 
major considerations when deciding between these two systems?  The API of 
MVStore seems to have much less bloat, but any experience with these two 
systems that I should consider?  We will probably be storing around 1 GB of 
with small string keys and JSON Strings as values.

-Adam

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Re: How to import a .db file into h2 database?

2018-03-16 Thread Adam McMahon
Hi,

I .db file is a native h2 database file.  It does not need to be imported, 
as it is simply the database itself, it simply needs to be opened.  The are 
several ways to open and read an h2 .db file, but the easiest way is to use 
the web interface console.  The quick start guide will be your friend 
here:  http://www.h2database.com/html/quickstart.html

What is your goal with the H2 file, do you just want to read the contents? 
Read it from a Java app?  Something else?

Also, note that other databases also use the .db file extension, so if you 
do not in fact have a native h2 database file, then the process of loading 
it into h2 is much more complicated.  Let us know where you are getting 
stuck in the quickstart guide and we will help you out.

-Adam




On Friday, March 16, 2018 at 3:55:03 AM UTC-4, Jian Zhang wrote:
>
> Hi,
>
> I have a .db file and I don't know how to import into the h2 database 
> since I'm new to this database engine. I have not found any useful 
> instructions yet.  Does someone know how to do with it?
>
> Thanks,
> Jian
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Re: Redhat warning about production use of H2

2018-03-07 Thread Adam McMahon
>>  How many times were you hit by a database corruption and couldn't 
recover any data at all?

never!  I have never not been able to recover data.  I use H2 on a 24/7 
sever system, and never had a corruption for years.  However, I do have a 
solid backup strategy in place so I am not too concerned if the DB gets 
corrupted: no one will lose life or job.

>>How many releases of H2 were tagged as stable and not as alpha/beta?

I think most databases have the same alpha/beta/stable release cycle.

>>Not matter how much I personally love using H2 for personal or 
professional projects, these 2 questions above always pop up in the mind of 
my team members. To them robustness is an issue with H2.

I agree.  Luckily I don't have people breathing down my neck, but I think 
it would be hard to justify using H2 when it is not seen as being an 
"enterprise" solution.

>>And it's the same with us, fervent users: we always look forward to the 
next release of H2, it's hard for us to tell which specific release was 
good enough in terms of speed and stability.

I tend to agree, but I am using an older 1.3x stable version and have not 
upgraded.  Why? because it works and I don't want to risk it with a newer 
version.  If it works, don't change it (or at least for my situation.

-Adam

On Wednesday, March 7, 2018 at 2:46:05 AM UTC-5, Christian MICHON wrote:
>
> How many times were you hit by a database corruption and couldn't recover 
> any data at all?
> How many releases of H2 were tagged as stable and not as alpha/beta?
>
> Not matter how much I personally love using H2 for personal or 
> professional projects, these 2 questions above always pop up in the mind of 
> my team members. To them robustness is an issue with H2.
>
> And it's the same with us, fervent users: we always look forward to the 
> next release of H2, it's hard for us to tell which specific release was 
> good enough in terms of speed and stability.
>
> On Wednesday, March 7, 2018 at 4:46:43 AM UTC+1, Adam McMahon wrote:
>>
>> Redhat has a warning about H2 in several places in their docs.
>>
>> The H2 database should *not* be used in a production environment. This 
>> is a very small, self-contained datasource that supports all of the 
>> standards needed for testing and building applications, but is not robust 
>> or scalable enough for production use. 
>>
>>
>> https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.1/html/configuration_guide/datasource_management
>>
>> I find this warning to be a little odd.  Perhaps RedHat is just trying to 
>> cover themselves legally.  Any ideas what aspects of H2 they might be 
>> referring to?  They mention 2 categories :
>>
>> *robust*: not sure what they mean in this context
>> *scalable* : I would agree with them here, if by scalable they mean 
>> having a bulit-in ability to horizontally scale across several machines.
>>
>> -Adam
>>
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Redhat warning about production use of H2

2018-03-06 Thread Adam McMahon
Redhat has a warning about H2 in several places in their docs.

The H2 database should *not* be used in a production environment. This is a 
very small, self-contained datasource that supports all of the standards 
needed for testing and building applications, but is not robust or scalable 
enough for production use. 

https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.1/html/configuration_guide/datasource_management

I find this warning to be a little odd.  Perhaps RedHat is just trying to 
cover themselves legally.  Any ideas what aspects of H2 they might be 
referring to?  They mention 2 categories :

*robust*: not sure what they mean in this context
*scalable* : I would agree with them here, if by scalable they mean having 
a bulit-in ability to horizontally scale across several machines.

-Adam

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] mvstore api - index?

2017-10-29 Thread Adam McMahon
Hi,

I am interested in the MVStore KeyValue store API.  It is not clear to me 
how indexes work for this.  Are the indexes implicitly created on each key 
for fast lookup? 

 I get the impression that the key are stored in a set of pages, and likely 
those pages will be accessed more frequently, and thus will likely be in 
memory - and thus it essentially has implicit indexes of a sort?

Thanks,

-Adam

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Re: is it save to use H2 in production for applications like Accounting or Stock?

2017-10-26 Thread Adam McMahon
Hi,

I do not write accounting apps.  But I use H2 in production for HR type 
apps for a major university.  H2 (embedded in tomcat) has been running 
24/7for several years with no corruption. We use the latest 2.3x version of 
H2.   We have built a custom layer that replicates the data in realtime to 
a Derby Database.  Every so often I run an integrity check between H2 and 
Derby to make sure the data is the same in both databases.  So far so good.

-Adam

On Wednesday, October 25, 2017 at 8:09:32 AM UTC-4, Noel L wrote:
>
>
>
> On Tuesday, 24 October 2017 20:41:24 UTC+11, ahmed altayib ahmed wrote:
>>
>> Hello every one,
>> is it save to use H2 in production for applications like Accounting or 
>> Stock? any similar experience exist?
>> thanks
>> Ahmed.
>>
>
> I have written an accounting system using H2 Version 1.3.176 as the 
> database and LibreOffice Base as the platform.  Currently it is running for 
> two different users with two more being established.  Over the last 5 years 
> or so, I have had no corruption episodes at all.  Occasionally LibreOffice 
> can close unexpectedly, but it virtually always automatically recovers the 
> database files.  During development, I've perhaps had only a couple of 
> cases where I've needed to recover from backups.  And that was when I had 
> done something pretty stupid!  (Note: I haven't yet ventured into the 
> 1.4.xxx versions.)
>
> Noel Lodge
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Select data from range between conversational openings and closings (chat log analysis using SQL / H2 Database)

2017-09-19 Thread Adam McMahon
My first instinct would be do do this at the application level. Not with a 
single query. It will be easy to do this in the application. So long as your 
data is not too big. 


-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] how do you store you documents?

2017-08-26 Thread Adam McMahon
Hi,

This is a little off topic, but I thought I would get feedback from the H2 
group.  When you need to store JSON in a database, how do you go about it? 
 Do you use H2, if not what do you use?

I was looking for a  dependable embedded JVM based DB that handles docs, 
but came up empty.  OrientDB looks good, but many complain that it is too 
buggy to use for anything serious.

JASDB looks cool, but does not seem to be highly used (and thus likely not 
dependable).

Of coures, JSON can be stored in an RDMS in a varchar or CLOB. The problem 
is running querries that can reach into the JSON.  It does not seem like it 
would be too hard to make a User-Defined function in H2 that allows one to 
query into a JSON doc that is stored in a text based column.  

t does not seem to be that hard to implement and could look something like 
this, where JSONquery is a java function that would allow one to drill into 
a text column with a simple DSL query language.  

  select * from myDocs where JSONquery(doc, 'o.name.first == 
Bob') AND JSONquery(doc, 'o.age > 25')

-Adam

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Version 1.3.176 not on download page

2017-07-23 Thread Adam McMahon
Hi, 

I am using H2 Version 1.3.176.  But I went to the download page and I no 
longer see it listed.  Was this version removed for some reason?  I would 
like to have the latest 1.3x, and I thought Version 1.3.176 was that 
version, but now that I see it is no longer online, I am wondering if it 
has been removed due to errors (or other reasons)?.

Thanks,

-Adam

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Any negative effects of a large varchar type?

2017-05-18 Thread Adam McMahon
I have this table with a varchar of size 10K

create table doc(
id BIGINT,
name VARCHAR(50),
body VARCHAR(1)
);

More often than not, the table will only store small values (less than 200 
characters) in the "body" column.  However, I want it to be big just in 
case. 

My Question: when creating table with the "possibility" of a large varchar, 
does that negatively impact the performance (speed or memory) of the 
database?  Does H2 do anything special to "antiicpte" large varchar 
entries, or is it exactly the smae as if I made the body column a smaller 
varchar.

I know that *if* I put a large value in the varchar, that will take memory, 
but I am speaking about the table structure and assuming that most values 
will be small?

-Adam

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Re: connecting to h2 from non-java languages

2017-02-24 Thread Adam McMahon
>> The solution you propose would involve would establish a connection for 
each query? I'd imagine that would not perform too well.

I agree that it would not perform too well to establish a new connection at 
each query.  Instead, I plan on using "long-lived" jdbc connections.  At a 
client's first http query, it creates a JDBC connection, if successful, it 
adds that connection to a map and keeps it "alive".  Every so often the 
connection is refreshed, and unused connections are reaped by a background 
thread.

>>I suggest establishing a connection once with one API call, which returns 
a token. Then use that token with future queries instead of supplying the 
credentials with each API call.

That is a good idea bout the token, but I am thinking about doing the 
following:  I suggest requiring the user/pass at each request (which makes 
each request the same format), and I grab the long-lived connection from 
the map keyed to String(userName+pass+ipadress).  This way a partciular 
client will aways get his connection back (assuming it has not been 
refreshed or reaped), and even if a different client uses the same username 
and password, they will still have their own connections (because the map 
of connection is keyed also to the client's ip address).  In short: the 
http server maintains a set of connection pools (with default size of 1) 
for each client that connects, and it reaps the connections periodically.

>> Maybe this project is what you are looking for
>>https://github.com/bjornharrtell/jdbc-http-server

This is interesting, thanks for sharing it.  But, there are a few 
limitations to that project (if I understand it correctly)
1.  It does not use standard "raw" sql for select/updates/insert/etc. 
 Instead, it uses a custom url (parameter based) format that, while being 
very REST-like, is non standard.
2.  According to the doc, the non-standard format can't handle more complex 
queries
3.  Does not take advantage of prepared statements.

Instead, I suggest a format that uses normal sql and allows prepared 
statements, which is delivered via a json string in the HTTP post, example:

{
user: 'dbUserName',
pass: 'password',
sql: "select * from users where name=? AND isIdiot=?",
params: ['Adam', true]
}



returns the result, something like:

[
{
name: "Adam",
isIdiot: true,
country: "USA",
language: "English"
}
]




On Friday, February 24, 2017 at 7:04:20 AM UTC-5, Manfred Rosenboom wrote:
>
> Maybe this project is what you are looking for
>
> https://github.com/bjornharrtell/jdbc-http-server
>
> Best,
> Manfred
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Re: connecting to h2 from non-java languages

2017-02-23 Thread Adam McMahon
Hi,

How does jRuby help in this situation?  Is there a particually nice jRuby 
http server that you use to wrap h2?

-Adam


On Thursday, February 23, 2017 at 4:56:23 PM UTC-5, Christian MICHON wrote:
>
> Spark contains an embedded jetty out of the box, and it's compatible with 
> SSL and keystores.
>
> I might contribute code if you open a github project. I usually handle 
> this "proxy" access to H2 using jruby, but it's straight forward to make 
> the concept you described in java.
>
> Christian
>
> On Thursday, February 23, 2017 at 7:19:28 PM UTC+1, Adam McMahon wrote:
>>
>> >>You'll need to ensure security, using json web tokens for example
>>
>> I have never used spark, looks fun (bad name for a project considering 
>> apache spark dominates the "spark" name). I was thinking Jetty would be 
>> pretty ideal, and/or restlet.  I also like Grizzly.  Vertx. is great, but 
>> maybe overkill and would require too many dependencies.
>>
>> I was thinking that the http server could optionally be run using an SSL 
>> connector (JSSE SSL).  Most micro-server frameworks make pretty easy to use 
>> ssl.  This should sufficiently  handle security over the wire.
>>
>> The format for querying the http server could be something like this in 
>> JSON:
>> {
>> user: 'dbUserName',
>> pass: 'password',
>> sql: "slect * from users where name=? AND isIdiot=?",
>> params: ['Adam', true]
>> }
>>
>> the response would just be an json array of rows.
>>
>>
>> The server could be run standalone something like this:
>> java -jar httpH2.jar  -options 
>>
>> The options.json would contain information like follwoing:
>> - path to DB:port
>>  -user name, password of h2 database
>> - embedded or TCP  (if embedded, the http server would run H2, else it 
>> will simply connect to an existing H2 TCP server over JDBC
>> - ip whitelist - list of ips that can access the http server
>>  -http port 
>>  - etc
>>
>>
>> On Thursday, February 23, 2017 at 6:13:28 AM UTC-5, Christian MICHON 
>> wrote:
>>>
>>> on point 2: it can be easily done with spark (sparkjava.com not apache 
>>> spark) + jooq
>>>
>>> You'll need to ensure security, using json web tokens for example.
>>>
>>> On Thursday, February 23, 2017 at 3:47:33 AM UTC+1, Adam McMahon wrote:
>>>>
>>>> Hi Group,
>>>>
>>>> i am considering a project that may require me to connect to an H2 
>>>> database froma non-JVM language (in this case php). I know the postgres 
>>>> driver might work and querus is an option, but I would like to consider a 
>>>> more general option: an http connector.
>>>>
>>>> It should be pretty easy to create a HTTP-JDBC bridge (perhaps an 
>>>> afternoon of work) that accepts a a post request (with a json payload 
>>>> describing the query) and return a json array of the results.  A simple 
>>>> servlet would do the trick that acts as a type of proxy to an underlying 
>>>> JDBC connection.
>>>>
>>>> My question is:
>>>>
>>>> [1] Perhaps this is already done in the web-console?  Is there 
>>>> documentation for how the server of the web-console could be used as a 
>>>> more 
>>>> general API over HTTP for H2?
>>>>
>>>> [2] Do you think anyone else would have use for this outside of my 
>>>> private projects?  I could fairly easily create a standalone sever 
>>>> (perhaps 
>>>> using embedded jetty) that would allow someone to  extend an H2 database 
>>>> over http. A few security things would need to be worked out, but it seems 
>>>> straight-forward.  This may be nice as it would open H2 to a variety of 
>>>> non 
>>>> JDBC languages (node.js, perl, php), using simple REST-like http 
>>>> requests...thoughts?
>>>>
>>>> -Adam
>>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Re: connecting to h2 from non-java languages

2017-02-23 Thread Adam McMahon
>>You'll need to ensure security, using json web tokens for example

I have never used spark, looks fun (bad name for a project considering 
apache spark dominates the "spark" name). I was thinking Jetty would be 
pretty ideal, and/or restlet.  I also like Grizzly.  Vertx. is great, but 
maybe overkill and would require too many dependencies.

I was thinking that the http server could optionally be run using an SSL 
connector (JSSE SSL).  Most micro-server frameworks make pretty easy to use 
ssl.  This should sufficiently  handle security over the wire.

The format for querying the http server could be something like this in 
JSON:
{
user: 'dbUserName',
pass: 'password',
sql: "slect * from users where name=? AND isIdiot=?",
params: ['Adam', true]
}

the response would just be an json array of rows.


The server could be run standalone something like this:
java -jar httpH2.jar  -options 

The options.json would contain information like follwoing:
- path to DB:port
 -user name, password of h2 database
- embedded or TCP  (if embedded, the http server would run H2, else it will 
simply connect to an existing H2 TCP server over JDBC
- ip whitelist - list of ips that can access the http server
 -http port 
 - etc


On Thursday, February 23, 2017 at 6:13:28 AM UTC-5, Christian MICHON wrote:
>
> on point 2: it can be easily done with spark (sparkjava.com not apache 
> spark) + jooq
>
> You'll need to ensure security, using json web tokens for example.
>
> On Thursday, February 23, 2017 at 3:47:33 AM UTC+1, Adam McMahon wrote:
>>
>> Hi Group,
>>
>> i am considering a project that may require me to connect to an H2 
>> database froma non-JVM language (in this case php). I know the postgres 
>> driver might work and querus is an option, but I would like to consider a 
>> more general option: an http connector.
>>
>> It should be pretty easy to create a HTTP-JDBC bridge (perhaps an 
>> afternoon of work) that accepts a a post request (with a json payload 
>> describing the query) and return a json array of the results.  A simple 
>> servlet would do the trick that acts as a type of proxy to an underlying 
>> JDBC connection.
>>
>> My question is:
>>
>> [1] Perhaps this is already done in the web-console?  Is there 
>> documentation for how the server of the web-console could be used as a more 
>> general API over HTTP for H2?
>>
>> [2] Do you think anyone else would have use for this outside of my 
>> private projects?  I could fairly easily create a standalone sever (perhaps 
>> using embedded jetty) that would allow someone to  extend an H2 database 
>> over http. A few security things would need to be worked out, but it seems 
>> straight-forward.  This may be nice as it would open H2 to a variety of non 
>> JDBC languages (node.js, perl, php), using simple REST-like http 
>> requests...thoughts?
>>
>> -Adam
>>
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] connecting to h2 from non-java languages

2017-02-22 Thread Adam McMahon
Hi Group,

i am considering a project that may require me to connect to an H2 database 
froma non-JVM language (in this case php). I know the postgres driver might 
work and querus is an option, but I would like to consider a more general 
option: an http connector.

It should be pretty easy to create a HTTP-JDBC bridge (perhaps an afternoon 
of work) that accepts a a post request (with a json payload describing the 
query) and return a json array of the results.  A simple servlet would do 
the trick that acts as a type of proxy to an underlying JDBC connection.

My question is:

[1] Perhaps this is already done in the web-console?  Is there 
documentation for how the server of the web-console could be used as a more 
general API over HTTP for H2?

[2] Do you think anyone else would have use for this outside of my private 
projects?  I could fairly easily create a standalone sever (perhaps using 
embedded jetty) that would allow someone to  extend an H2 database over 
http. A few security things would need to be worked out, but it seems 
straight-forward.  This may be nice as it would open H2 to a variety of non 
JDBC languages (node.js, perl, php), using simple REST-like http 
requests...thoughts?

-Adam

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Re: Query Optimizer limitations

2017-01-19 Thread Adam McMahon
Also, if you can, try loading the data into another DB and running the same 
querry.  This will give you an idea if it is a problem with how you are 
using H2, or if it is just a hard query for most engines to optimize.  
Also, you may get faster results if you use the H2 PageStore engine.

On Thursday, January 19, 2017 at 3:26:21 PM UTC-5, Adam McMahon wrote:
>
> As far as I am aware, the problem with the query optimizer is that it does 
> not use indexs in every situation that one might expect.  But yours seems 
> to be using the index.  So, I don't know what else it could be (but I am no 
> expert at H2).
>
> How long does it take to run the query?  How many rows are there, and what 
> is the general size of the rows (number of columns)?
>
>
>
> On Thursday, January 19, 2017 at 5:47:55 AM UTC-5, Anil Dasari wrote:
>>
>> Hi Adam,
>>
>> I mean query is very slow. Explain plan looks good and it is using index. 
>> I did not compare with other databases. 
>>
>> Thanks.
>>
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Re: Query Optimizer limitations

2017-01-19 Thread Adam McMahon
As far as I am aware, the problem with the query optimizer is that it does 
not use indexs in every situation that one might expect.  But yours seems 
to be using the index.  So, I don't know what else it could be (but I am no 
expert at H2).

How long does it take to run the query?  How many rows are there, and what 
is the general size of the rows (number of columns)?



On Thursday, January 19, 2017 at 5:47:55 AM UTC-5, Anil Dasari wrote:
>
> Hi Adam,
>
> I mean query is very slow. Explain plan looks good and it is using index. 
> I did not compare with other databases. 
>
> Thanks.
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Re: Query Optimizer limitations

2017-01-18 Thread Adam McMahon
Hi,

when you say performance is very bad, what do you mean?  What is slow to 
you?  By slow, do you mean slow compared to other databases?  Does it use 
index?  Do you expect the querry to use an index that it is not using (try 
the explain method to learn about what the query is doing behind the 
scenes).



On Tuesday, January 17, 2017 at 12:20:26 PM UTC-5, Anil Dasari wrote:
>
> Hi,
>
> I have created a simple join query between two tables and performance is 
> very bad.
>
> I read the documentation and understand that query optimizer have some 
> limitations. i would like to go thorough them before actually posting the 
> my query having the issues.
>
> Could you please point me to the query optimizer limitations ? thanks.
>
> Thanks.
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Re: Honest Opion

2016-11-23 Thread Adam McMahon
You may want to clarify what you mean by reliable.

But here is my 2 cents:

I have several small h2 databases that have run continuously for several 
years as part of a web app. No problems at all.

As with any database, you will want to perform regular backups, and 
understand well how to manage the particular database.

I find H2 just as reliable as other opensource databases.

-Adam


 

On Wednesday, November 23, 2016 at 3:53:57 PM UTC-5, Warren Basterfield 
wrote:
>
> How reliable is H2 ?
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Re: question about mixed mode

2016-11-12 Thread Adam McMahon
Hi,

To answer my own question, it seems that if the tcp server is started 
progmatically, the JVM that starts the server can connect via embedded 
mode, while others can connect via TCP.  I have not tried this on two 
different servers at the same time, but it works locally.  Does this sound 
about right.

-Adam

On Saturday, November 12, 2016 at 6:39:35 PM UTC-5, Adam McMahon wrote:
>
> I have an embedded database that I would like to open up to other servers. 
>  It seems like mixed mode is the way to go. But, I see in the docs for 
> automatic mixed mode that "All processes need to have access to the 
> database files".  By this I read that the remote servers all need to be 
> able to read the actual database files, not just connect over TCP.  In my 
> case, the remote servers will not be able to read the files, but can 
> connect over TCP
>
> Is automatic mixed the only form of mixed mode? or is there a way to have 
> an embedded database that allows remote connections without regard to 
>  being able to read the database files?
>
> Thanks,
>
> -Adam
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] question about mixed mode

2016-11-12 Thread Adam McMahon
I have an embedded database that I would like to open up to other servers. 
 It seems like mixed mode is the way to go. But, I see in the docs for 
automatic mixed mode that "All processes need to have access to the 
database files".  By this I read that the remote servers all need to be 
able to read the actual database files, not just connect over TCP.  In my 
case, the remote servers will not be able to read the files, but can 
connect over TCP

Is automatic mixed the only form of mixed mode? or is there a way to have 
an embedded database that allows remote connections without regard to 
 being able to read the database files?

Thanks,

-Adam

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] order of updates

2016-11-07 Thread Adam McMahon
Hi,

If updates are being sent to H2 (embedded) from several threads, is there 
any known order in which the updates occur? Are they queued in the order 
the update operations arrive to H2? 

Example:

ThreadA - updateA at T1
ThreadB - updateB at T2
ThreadC - updateC at T3

(T1

[h2] help picking H2 version

2016-10-21 Thread Adam McMahon
Thanks for clarification

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] help picking H2 version

2016-10-20 Thread Adam McMahon
Hi Group,

Sorry if I am being repetitive here, but I am still a little confused about 
which H2 version to pick.  I have the following needs:

[1] JSBC with PageStore

[2] MVStore Map API with OffHeapBuffer

what is the recommended stable version for those two features?

-Adam


-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Re: Main differeces between 1.3 and 1.4 versions

2016-10-18 Thread Adam McMahon
Good info here

So, what version of 1.4x would you use in your production environment.   I 
use pagestore for JDBC, but am also going to be integrating MVSTORE via the 
map api (not JDBC) using its OffHeapStore.  What version would you 
recommend.

Thanks,

-Adam

On Tuesday, October 18, 2016 at 4:24:33 PM UTC-4, Petr Holík wrote:
>
> Hello,
>
> I've done some investigation of relation between 1.3(stable) and1.4(beta) 
> - Hope it somebody helps to pick proper version for conrete suits.
> Please feel free to correct me:
>
>  * Development of version 1.3 is discontinued - all bugs found are fixed 
> only in 1.4 version
>  * Git branch tagged version1.3 only contains snapshot of released sources 
> of particular 1.3 versions and there is not and WILL NOT be any further 
> development
>  * 1.4 is Beta because of new MV_STORE which is default since 1.4.177 AND 
> because of MVCC enabled
>  * 1.4 can be used for production same as 1.3 when 
> ;MV_STORE=FALSE;MVCC=FALSE  is appended to JDBC URL (MVCC is now disabled 
> when not using MV_STORE - so potetionally can be omited)
>  * MV_STORE has few data corruption issues  but since 2015-10-11 is there 
> was no new one
>  * MV_STORE should now have pretty similar performance as old one but 
> delivers some new cool Map-Like  features, which can be used 
> directly.
>  * There are no _unfixed known bugs_ on MV_STORE but there still exists 
> few open data corruption bugs related to this store(which may or may not be 
> caused by it)
>
>
> Sincerely Petr Holik
>
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Re: MVstore - off heap storage

2016-10-18 Thread Adam McMahon
>[4] Can we persist to disk the contents in an OffHeapStore (take a 
snapshot to disk and then reload it when the app restarts)?

I think [4] has a pretty simple implementation.  When a user wants to save 
to disk, just create a temporary FileStore, and copy all the key-values 
from the Off-Heap-Store into the FileStore map(s), and the commit and close.

This could be built into to the OffHeapStore as a function: public void 
saveToFile(fileName), and a corresponding loadFromFile(fileName) that does 
the reverse.  But it could just as easily be done by the applilcation 
programmer instead of being built into the OffHeapStore class.

-Adam



On Monday, October 17, 2016 at 7:27:43 PM UTC-4, Adam McMahon wrote:
>
> Hi,
>
> I am a long time user of H2, but I am now just exploring the MVstore map 
> api.   Great stuff, a few questions:
>
> [1]  Off heap storage - is there any way to designate the size of the 
> offheap store, or does it just continue to fill up until it runs out of 
> memory?
>
> [2]  Off heap storage - Can we  designate how much of the map should be in 
> heap vs offheap?
>
> [3] Can the Off heap storage be used in conjunction with an overflow file 
> storage (for example, if so much memory is used it overflows to a file?
>
> [4] Can we persist to disk the contents in an OffHeapStore (take a 
> snapshot to disk and then reload it when the app restarts)?
>
> Best,
>
> -Adam
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] MVstore - off heap storage

2016-10-17 Thread Adam McMahon
Hi,

I am a long time user of H2, but I am now just exploring the MVstore map 
api.   Great stuff, a few questions:

[1]  Off heap storage - is there any way to designate the size of the 
offheap store, or does it just continue to fill up until it runs out of 
memory?

[2]  Off heap storage - Can we  designate how much of the map should be in 
heap vs offheap?

[3] Can the Off heap storage be used in conjunction with an overflow file 
storage (for example, if so much memory is used it overflows to a file?

[4] Can we persist to disk the contents in an OffHeapStore (take a snapshot 
to disk and then reload it when the app restarts)?

Best,

-Adam

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Re: H2 embeded User-Defined class problem spring hibernate unit test

2016-09-27 Thread Adam McMahon
I think H2 only supports user defined functions, not classes.  The docs say:

"When referencing a method, the class must already be compiled and included 
in the classpath where the database is running. Only static Java methods 
are supported; both the class and the method must be public"

However, you do not have any static methods, that will be something to look 
into. Also, the ALIAS is to the method, not the class.

On Tuesday, September 27, 2016 at 1:28:27 PM UTC-4, Adam McMahon wrote:
>
> The jar with your user defined class needs to be in your class path,  that 
> seems to be the first place to check

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] H2 embeded User-Defined class problem spring hibernate unit test

2016-09-27 Thread Adam McMahon
The jar with your user defined class needs to be in your class path,  that 
seems to be the first place to check

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] Re: how are subqueries executed in an IN Select

2016-09-19 Thread Adam McMahon
Noel,

Thanks for the suggestion.  I opted for a JOIN for the time-being.  I am a 
little hesitant to upgrade h2 versions, because we are using it in 
production.  When I have time, I hope to locally test the newest stable h2 
to see if the IN Select is now optimized to not repeat a sub-query.

Best,

-Adam

On Monday, September 19, 2016 at 2:59:17 AM UTC-4, Noel Grandin wrote:
>
> Convert it to a join.​ 
>
> Or pick a newer version, but stick with the PAGE_STORE engine, I'm pretty 
> much we've made lots of plannerimprovements since 1.3.176
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Re: how are subqueries executed in an IN Select

2016-09-18 Thread Adam McMahon
Hi,

I put in a logger via a user defined function, and it seems to in fact 
re-execute the IN sub-query for every matching outer row.  Am I 
interpreting this correctly?  Any work around?

-Adam

On Sunday, September 18, 2016 at 8:25:20 PM UTC-4, Adam McMahon wrote:
>
> Hi,
>
> When a SELECT is used as a sub-query of an IN, is the sub-query only 
> executed once?  Consider the following made up query that finds all staff 
> members who are in the state of California who are also a student majoring 
> in Computer Science.
>
> select * from students where major='CSC' and id IN (select id from staff 
> where state='CA')
>
> Does H2 first execute the sub-query, and the the outer one?  Or does it 
> execute the sub-query at every row match from the outer query?  I am using 
> version  1.3.176  with page store (if that matters).
>
> Thanks,
>
> -Adam
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] how are subqueries executed in an IN Select

2016-09-18 Thread Adam McMahon
Hi,

When a SELECT is used as a sub-query of an IN, is the sub-query only 
executed once?  Consider the following made up query that finds all staff 
members who are in the state of California who are also a student majoring 
in Computer Science.

select * from students where major='CSC' and id IN (select id from staff 
where state='CA')

Does H2 first execute the sub-query, and the the outer one?  Or does it 
execute the sub-query at every row match from the outer query?  I am using 
version  1.3.176  with page store (if that matters).

Thanks,

-Adam

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] performance of updating rows with indexes

2016-06-09 Thread Adam McMahon
H2 Group,

I have read that there is sometimes a performance hit when updating a row 
that has an index.  But, I imagine that this performance hit only typically 
comes when the indexed column is changed, and that there will likely be no 
performance hit if a non-index column is updated.  For the most part, is 
this correct?

Best,

-Adam

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] embedded vs sever mode stability of h2?

2016-01-21 Thread Adam McMahon
Hi,

We currently use h2 embedded in a tomcat app.  Works great.  There may be a 
time in which we have to move h2 to a separate server, and thus use h2 
server mode.

I get the impression that most people use h2 in embedded mode.  Is there 
any reason to think that h2 server mode is less stable or error prone, as 
it seems to have more moving parts?  This would be a server that runs 24/7.

Thank,

-Adam

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] MVMap multikey

2015-12-09 Thread Adam McMahon
I don't know exactly how this maps to H2's MV.  but can't you just have 
only Strings as keys.  When you need a Long as a key, just take the string 
value of the Long.  

-Adam

On Wednesday, December 9, 2015 at 4:31:50 PM UTC-5, Jan Juno wrote:
>
> Hi
>
> Each entry has 2 types of keys Long and a Hash256(String).
>  You want to lookup for a value using Long or hash string.
>
>
> On Monday, December 7, 2015 at 9:33:13 AM UTC+1, Thomas Mueller wrote:
>>
>> Hi,
>>
>> Could you give an example please? Your description is not clear to me.
>>
>> >  but uses multiple (differently-typed) keys
>>
>> Each entry has multiple keys, or different entries have different keys? 
>> Maybe you need multiple maps? 
>>
>> Regards,
>> Thomas
>>  
>>
>> On Sat, Dec 5, 2015 at 5:44 PM, Jan Juno  wrote:
>>
>>> I need a data structure which behaves like a Map, but uses multiple 
>>> (differently-typed) keys to access its values.
>>> How would you go dong it?
>>> Create a Key Class implementing DataType interface?
>>> Can someone show me an example?
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "H2 Database" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to h2-database...@googlegroups.com.
>>> To post to this group, send email to h2-da...@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/h2-database.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] setFetchSize with large ResultSet embdded mode

2015-12-02 Thread Adam McMahon
H2 Group,

I am trying to understand Statement.setFetchSize with large ResultSets.  
The documentation says that it this function sets the number of rows 
suggested to read in one step. What does it mean by "suggested".  In what 
situations is the setFetchSize value not honored?  

My the situation is the following.  We have a large (and growing) table in 
embedded H2.This is what I would like to do to avoid loading the entire 
contents of myBigTable into memory, either in the ResultSet or somewhere in 
the H2DB layer.

-
statemnet.setFetchSize(10)
results = select * from myBigTable
while (hasMoreResults) 
   processes results.next()


In embedded mode, I want to avoid loading the entire contents of myBigTable 
into memory, either in the H2 DB layer or in the ResultSet My assumption is 
that the above pattern will first buffer the results of myBigTable to disk 
(assuming my table it big enough) , and then (in a chucked format with 10 
at a time via the fetchsize), load the next 10 results and pass it to the 
embedded client.  Thus the entire BigTable will never be fully loaded into 
memory.  Sound correct?

I use latest stable with PageStore.

Thanks,
-Adam

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] Are order of results always the same?

2015-11-25 Thread Adam McMahon
 

Thanks for your pointer on this.


What about this scenario:


I have a rather large table that I would like to process in the application 
in batches using a paging mechanism with OFFSET and LIMIT. I plan to do 
this in a simple loop which gets results N at a time, and each time 
increasing the OFFSET by N. I don't care the order in which these items are 
processed, but I need to make sure all are processed.


If subsequent SELECTS do not have the same order, does that effect the 
above scenario? In other words, if OFFSET/LIMIT trims the results sent back 
to the client, could the OFFSET/LIMIT be trimming at different places in 
the SELECT such that a loop with OFFSET/LIMIT never actually goes through 
the entire table, but instead sends back an arbitrary set.


For example, lets say I have a table with 50 names. I want to process these 
names 10 at a time, so I create a simple loop using OFFSET/LIMIT. Without 
adding in an ORDER BY, will it actually go through all 50 names. Or do I 
need to add an ORDERBY to ensure that the OFFSET knows what index to start 
at in the SELECT.


I hope this makes sense.


-Adam


On Wednesday, November 25, 2015 at 2:52:22 AM UTC-5, Noel Grandin wrote:
>
> You can't rely on that. If you need order, you need to enforce it with an 
> ORDER BY clause. 
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Are order of results always the same?

2015-11-24 Thread Adam McMahon
Hi,

It looks like the results of a querry are always given back in the same 
order.  Is this always true?  I know the order of a returned result is not 
the same as the insertion order.  But if a query is performed, and then 
repeated, will the result set be in the order (assuming the relevant tables 
have not changed?

Thanks,

-Adam 

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] deadlock with clob data types?

2015-06-14 Thread Adam McMahon
I guess another route would be to change the datatype to varchar.  Is this 
possible?  Is it safe?

-Adam


On Sunday, June 14, 2015 at 12:46:55 PM UTC-4, Adam McMahon wrote:

 Noel,

 Thanks for the suggestion.  When you say latest version, do you mean 
 latest stable version, or the latest build?

 Would the upgrade process be to simple replace the jar and restart the 
 DB?  Or is it best to restore a fresh DB from sql script?

 -Adam 

 On Sunday, June 14, 2015 at 2:54:40 AM UTC-4, Noel Grandin wrote:

 We have fixed a bunch of stuff around LOB'S since then. I suggest you 
 update to the latest version but run with mvstore disabled 
 On Sun, 14 Jun 2015 at 02:31, Adam McMahon ad...@cs.miami.edu wrote:

 Hi,

 I am using H2 to store text as clobs.  
 The operations go like this:

 The clobs are read into a String from the DB 
 The String is transformed into a json ojbect
 the json object is modified 
 the object is transformed into a json string and saved back into H2 as a 
 clob

 Multiple threads are performing the above operations at the same time. 

  I am running into thread dead locks when doing this.  If I synchronize 
 around my methods which Select and Execute into the database, I do not run 
 into the deadlocks.  Thus, I am avoiding the problem by making sure that 
 all my calls to H2 are synchronized in my code, which makes me wonder if 
 there is a synchronization problem somewhere in H2.   Are there any known 
 deadlock problems in h2 with regard to clobs or the such.  

 H2 version: {name=info.VERSION, value=1.3.176 (2014-04-05)}

 Thanks,
 -Adam

 -- 
 You received this message because you are subscribed to the Google 
 Groups H2 Database group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to h2-database...@googlegroups.com.
 To post to this group, send email to h2-da...@googlegroups.com.
 Visit this group at http://groups.google.com/group/h2-database.
 For more options, visit https://groups.google.com/d/optout.



-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] deadlock with clob data types?

2015-06-14 Thread Adam McMahon
Noel,

Thanks for the suggestion.  When you say latest version, do you mean latest 
stable version, or the latest build?

Would the upgrade process be to simple replace the jar and restart the DB?  
Or is it best to restore a fresh DB from sql script?

-Adam 

On Sunday, June 14, 2015 at 2:54:40 AM UTC-4, Noel Grandin wrote:

 We have fixed a bunch of stuff around LOB'S since then. I suggest you 
 update to the latest version but run with mvstore disabled 
 On Sun, 14 Jun 2015 at 02:31, Adam McMahon ad...@cs.miami.edu 
 javascript: wrote:

 Hi,

 I am using H2 to store text as clobs.  
 The operations go like this:

 The clobs are read into a String from the DB 
 The String is transformed into a json ojbect
 the json object is modified 
 the object is transformed into a json string and saved back into H2 as a 
 clob

 Multiple threads are performing the above operations at the same time. 

  I am running into thread dead locks when doing this.  If I synchronize 
 around my methods which Select and Execute into the database, I do not run 
 into the deadlocks.  Thus, I am avoiding the problem by making sure that 
 all my calls to H2 are synchronized in my code, which makes me wonder if 
 there is a synchronization problem somewhere in H2.   Are there any known 
 deadlock problems in h2 with regard to clobs or the such.  

 H2 version: {name=info.VERSION, value=1.3.176 (2014-04-05)}

 Thanks,
 -Adam

 -- 
 You received this message because you are subscribed to the Google Groups 
 H2 Database group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to h2-database...@googlegroups.com javascript:.
 To post to this group, send email to h2-da...@googlegroups.com 
 javascript:.
 Visit this group at http://groups.google.com/group/h2-database.
 For more options, visit https://groups.google.com/d/optout.



-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] deadlock with clob data types?

2015-06-13 Thread Adam McMahon
Hi,

I am using H2 to store text as clobs.  
The operations go like this:

The clobs are read into a String from the DB 
The String is transformed into a json ojbect
the json object is modified 
the object is transformed into a json string and saved back into H2 as a 
clob

Multiple threads are performing the above operations at the same time. 

 I am running into thread dead locks when doing this.  If I synchronize 
around my methods which Select and Execute into the database, I do not run 
into the deadlocks.  Thus, I am avoiding the problem by making sure that 
all my calls to H2 are synchronized in my code, which makes me wonder if 
there is a synchronization problem somewhere in H2.   Are there any known 
deadlock problems in h2 with regard to clobs or the such.  

H2 version: {name=info.VERSION, value=1.3.176 (2014-04-05)}

Thanks,
-Adam

-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] preserve capitalization of column names in returned meta data

2015-02-08 Thread Adam McMahon
Hi,

When we get the meta data of a result set, it appears that the 
capitalization of the column names is not preserved.  Is there anyway to 
preserve it the returned meta results?

-Adam

-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] does LIMIT improve performane

2015-01-04 Thread Adam McMahon
Hi,

I have a large table in which I need to find only one matching record from 
the table.  If I put in a LIMIT 1, could that improve performance? 

 If there is a limit, does the engine stop searching once the LIMIT has 
been found?  Or is the LIMIT applied as a filter after the search has been 
performed?

Thanks,

-Adam

-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] using h2 servlet console with embedded derby

2014-06-24 Thread Adam McMahon
Thomas,

I am using h2/derby (both embedded) within a tomcat app.  The H2 console is 
exposed via the WebServlet.   The h2 and derby jars are placed in tomcat's 
lib directory.  I know derby.jar is loaded because the web app works fine 
with derby - except derby does not work with the H2 console.  It says no 
suitable driver found (I use the same derby driver and derby URL that I use 
within the app).

At the end of the day, it is no big deal.  We created a custom console that 
works with both, and it better suits our needs (I would share it with the 
community, but it is clunky and more suited to our unique use).  Though I 
was curious why I could not get the H2 console to work.

Thanks,
-Adam



On Thursday, June 19, 2014 1:42:35 AM UTC-4, Thomas Mueller wrote:

 Hi,

 If the Derby JDBC driver is in the classpath, then I'm afraid I don't know 
 what the problem could be. 

 Should the h2 console work with derby?


 Sure.
  

   Am I doing something wrong?


 I would double check if the Derby JDBC driver is really in the classpath.

 Where exactly did you put the Derby driver jar file?

 Regards,
 Thomas


-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] using h2 servlet console with embedded derby

2014-06-14 Thread Adam McMahon
Hi,

We are building our web-app to be compatible with both embedded H2 and 
embedded Derby, with the idea that we can switch out one for the other at 
any time.  Though we plan on using H2 in our final app (if everything works 
as expected).   

We use the H2 console (as a servlet) to manage the embedded H2 database 
remotely.  In the H2 servlet console it appears that we should be able to 
use the console for derby as well.  In the console, I select the generic 
derby embedded driver (org.apache.derby.jdbc.EmbeddedDriver), which is the 
same one used in our app, and the I use the same jdbc url that we use in 
our app: jdbc:derby:c:/derby/bin/mydb.  I leave user and password blank 
because we do not have user/password for derby setup yet.  But, it gives 
the error no suitable driver found.   

Clearly the derby driver is part of our web-app, because our web-app works 
with derby... just not the h2 servlet console.


Should the h2 console work with derby?  Am I doing something wrong? It 
would be great if it works with Derby also, but if it does not that big of 
deal if it does not.  I have built a simple console that is compatible with 
both H2 and Derby, but it is not as rich as the H2 console.

Thanks,
-Adam

-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] understanding preparestatement reuse

2014-06-04 Thread Adam McMahon
Noel,

Thanks for helping out. 

For some reason I thought that JDBC or the database handles caching of 
prepared statements (perhaps it does on some databases), and I am sure many 
of the java connection pools take care of this out of the box.  But, we use 
a custom connection pool, and it was easy enough to add a simple statement 
cache to each connection. For anyone interested in implementing something 
like this, I found this link helpful: 
https://code.google.com/p/h2database/source/browse/trunk/h2/src/test/org/h2/samples/CachedPreparedStatements.java

-Adam



On Wednesday, June 4, 2014 5:55:42 AM UTC-4, Noel Grandin wrote:


 On 2014-06-03 08:37 PM, Adam McMahon wrote: 
  
  Now lets say that I want to later reuse that prepared statement, which 
 is more accurate: 
  
  1) do I need to keep a reference to the actual PreparedStatment object 
 (in this case ps). 

 Yes. 

  If this is the case, do I not close the prepared statement? 

 No, you do not close it. 



-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] web console Servlet - how to not allow others to create new databases

2014-06-03 Thread Adam McMahon
Hi,

We use embedded H2 in a webapp with tomcat. We use the servlet webconsole 
to manage the database.  Our database is password protected, which should 
allow some security.  But I don't see how to prevent an unauthorized user 
from creating a new database and filling it with junk if they visit the 
webconsole url.  Our current method to prevent this is to simply obscure 
the web-console url-pattern to something that is hard to guess or know - 
thus trying to prevent someone from stumbling upon it.   Though I do not 
think this is a full solid security method.

Any ideas or tips on how to 
1) secure the web-console servlet
2) prevent others from creating new databases if they find the url.

Thanks,
-Adam

-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] understanding preparestatement reuse

2014-06-03 Thread Adam McMahon
Hi,

I frequently use PreparedStatements, but I am a bit unsure how to properly 
reuse them.

I create a statement

String sql = select * from users where score?;
PreparedStatement ps = con.prepareStatement(sql);
ps.setInt(1, n);
ResultSet rs = ps.executeQuery();
// do stuff
rs.close();
ps.close();
con.close();

Now lets say that I want to later reuse that prepared statement, which is 
more accurate:

1) do I need to keep a reference to the actual PreparedStatment object (in 
this case ps).  If this is the case, do I not close the prepared 
statement?
2) can I reuse the preapred statment by just sending the same sql String 
when creating a PresparedStatement from a connection. 

In other words, does the programmer need to keep around references of 
prepared statement objects, or does the database (in this case H2) keep a 
cache based on the parametrized sql String that is sent to the connection.  

Thanks for any help.
-Adam


-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] inserrting/updating CLOB using prepared statements

2014-05-27 Thread Adam McMahon
Hi,

I would like to use the Clob data type for my variable length strings that 
average around 300 characters.   I see in the doc that I should use  
PreparedStatement.setCharacterStream to store values.   Instead I am 
simply using PreparedStatment.setString().   This seems to work.  Is there 
any advantage to using setCharacterStream?  This may be more of a JDBC 
question than an H2 question, but I thought I would start in this group 
with the question.

Thanks,
-Adam

-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] H2 Clusters- load balancing SELECT querries

2013-11-12 Thread Adam McMahon
Thomas,

This sounds like a good plan, and I realize there is a strong priority for 
the MVStore. 

When I look at the other major DBs: MySQL, Mongo, etc.  They all seem to 
have a feature to allow replication for faster reads. While H2 may fit a 
different market than these other DBs, but it would be nice to have have 
replication performance boosts.

For my particular use case, I use H2 for rest/web services (similar to how 
many people use MySQL/Mongo).  Here is my scalability flow/plan:

1) For for most services, I simply embed H2 in the web server - this works 
great, simple and super fast.
2) If the volume on the services gets too high and heaps sizes are too big, 
H2 is split to client/server mode on the same CPU
3) If the volume continues to increase, then H2 can be put on a dedicated 
server.
4) But what next?  there is no way to scale higher via a cluster.  Because 
of this fact, individuals may pick another DB (which is fine if H2 does not 
want to compete in this space).

Another potential problem of H2 scalability is that of large 
garabage collection pauses on large heap sizes.  This is not a problem with 
H2, but a problem with Java in general.  If someone has a dedicated H2 
server and wants to scale higher, they may not get much more power by 
increasing H2's cache, as I imagine it will (like most Java apps) run into 
problems with large heap sizes.  So, really H2 will likely cap its 
scalabilty on a commodity computer with about 4 GB of ram (if the user is 
concerned with having low latency for requests).

Cluster replication might just save the day here.  When volume of requests 
or heap sizes get too big, replication can be used to scale horizontally. 
 But then again, perhaps I am looking at H2 to do something that it is not 
intended to do, and where another DB may be a better fit, which is fine.

Thanks for your hard work on this great product.

-Adam



On Tuesday, November 12, 2013 8:39:55 AM UTC-5, Thomas Mueller wrote:

 Hi, 

 I'm afraid the current implementation does not support it. Of course this 
 could be changed, actually I guess it would be relatively easy to remove 
 the check. 

 At some point I think it's better to re-implement clustering. But first my 
 priority is to work on the new storage engine (the MVStore), I plan to use 
 this mechanism as the base for the new clustering. 

 Regards, 
 Thomas 
 Am 12.11.2013 02:40 schrieb Adam McMahon ad...@cs.miami.edujavascript:
 :

 H2 Group,

 I am checking out the clustering features of H2.  I know that the 
 clustering features are fairly barebones.  I am  interested in 
 using clusters/replication for increased performance, as opposed to simply 
 having a failsafe DB online (which is also a good thing  :). 

 In the past, using MySQL replication, I would send write queries to the 
 master (which would eventually be propogated), and then I would load 
 balance between the master/slaves for read queries.  I would do this at the 
 application level by simply changing the JDBC url depending on if the SQL 
 was a write or a read.  The slaves might be a little behind the master, but 
 that was fine for many of my queries.

 I know that load balancing is not a built in feature to H2 clustering, 
 but I figured I may be able to accomplish it at the application level using 
 something like the above.  However, it seems that I am not able to do so, 
 as client connections to an individual server with in a cluster are 
 rejected.  I appears we can only connect to using the server list url.

 My question: is there any way to load balance reads across a slave? 

 Thanks,  -Adam

 -- 
 You received this message because you are subscribed to the Google Groups 
 H2 Database group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to h2-database...@googlegroups.com javascript:.
 To post to this group, send email to h2-da...@googlegroups.comjavascript:
 .
 Visit this group at http://groups.google.com/group/h2-database.
 For more options, visit https://groups.google.com/groups/opt_out.



-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [h2] H2 database on multiple threads/cores

2013-11-11 Thread Adam McMahon
Noel,
 
As always, thanks for your insights.  It is good to know that H2 at its 
cores is single threaded while at the same time multithreaded at outer 
layers. , this will help me as I think about my design.  
 
SSD is a good option, looking to use Digital Ocean 
https://www.digitalocean.com/.  Good SSD, but it only scales CPU via more 
cores not time slices (as opposed to http://www.linode.com)   I have a 
hunch this mutli core scaling is not the best option for H2.  But overall 
seems like nice service, and my hunches are often times wrong  :)
 
-Adam
 

On Sunday, November 10, 2013 4:16:28 AM UTC-5, Noel Grandin wrote:

 The short answer is that it's complicated. 

 You're probably better off creating some performance tests for your 
 application and testing them out on the various options. 
 Since the answers will vary depending on how your application uses the DB. 
 For database applications I would recommend you pick the provider that 
 supplies SSD storage. 

 The longer answer is that H2 is composed of multiple layers. The 
 lowest layer is single-threaded, but the layers and caches above that 
 are multi-threaded, and since a lot of queries spend a lot of time 
 processing data, rather than reading/writing to the disk, we actually 
 get a fair amount of parallelism out of our architecture. 


-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.


[h2] H2 database on multiple threads/cores

2013-11-09 Thread Adam McMahon
Hi H2 Group,

I am trying to get my head around H2's use of multiple threads and cores. 
 I know this topic has been dealt with before, but I am still a little 
confused on the topic.  My questions are with regard to the default mode of 
H2 (not MVCC or multithreaded=true).

A) the documentation states that most requests to the same database are 
synchronized.  

B) However, document goes on to discuss read and write locks.  This feature 
sounds similar to Java's standard ReadWriteLock functionality, which is 
used to have concurrent reads on data, while preventing reading during a 
synchronized write.

I am having difficulty understanding the two above statements.  My current 
interpretation is that read requests (SELECT, etc) can be done in parallel, 
while INSERT, UPDATE, etc cannot be done in parallel.  However, I am a bit 
doubtful that this interpretation is correct.

C) In my current application, I have noticed that I can perform 
some concurrent operations.   For example, a long running SELECT/ORDER_BY 
on Table A does not prevent quick selects on Table B.  So, clearly some 
operations can be done in parallel on multiple threads/cores (perhaps it is 
the ORDER_BY that is done concurrently here?).  Any clarification as to 
what operations can be done concurrently would be great.

D)  Finally, I am looking at a couple VPS providers to host an H2 server. 
 Some VPS companies provide scalable CPU power by [1] providing increasing 
CPU time slices with a smaller number of cores, while other companies 
provide scalable CPU power by [2] providing a larger number of cores with 
out an increase in CPU time slices.  Since H2 is not highly multi threaded, 
it seems like H2 would do better in a situation similar to [1].  Would you 
agree?

Thanks. -Adam


-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [h2] Understanding Query Cache

2013-11-07 Thread Adam McMahon
Noel,
 
Thanks for the reply.  that makes sense with the access rights between 
sesisons.  Liek you mentioned, I was also starting to release that the 
querry cache is of limited use, and that perhaps (for my case) a cache 
outside of the database is a better setup anyway.  So, I am just now 
setting the querry cache to 0 and using an external caching mechanism.
 
I assume that setting the query cache to 0 will have no real negative 
effects, other than simply not caching the result sets of querries a small 
number of querries.
 
Thanks,
-Adam
 
 

On Thursday, November 7, 2013 3:04:19 AM UTC-5, Noel Grandin wrote:



 On 2013-11-04 03:39, Adam McMahon wrote: 
  On a similar note, it seems like a global query cache, as opposed to a 
 separate one for each session, would be useful. 
  

 Can't do that, because of differences in access rights, etc, etc. between 
 sessions. 
 So we use a page cache, which actually does most of the heavy lifting in 
 reducing disk access. 
 The query cache is generally of limited use, which is why it defaults to 
 being so small. 


-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.


[h2] Re: getting the ROWNUM of a specific row with a WHERE

2013-07-27 Thread Adam McMahon
Hi,

I am quite late at getting back to this, but I thought I would go ahead and 
post the test case.  What I want is the rank of a user's score, which is 
the row number of a user after sorting the table in descending order.

Here is a table with some data:

create table scores( 
userId int,
score int 
);
INSERT into scores VALUES (1, 1);
INSERT into scores VALUES (2, 100);
INSERT into scores VALUES (3, 25);
INSERT into scores VALUES (4, 75);

SELECT *, rownum as rn from (select userId, score from scores ORDER BY 
score DESC);

After sorting, we see that userId=4 has a rank (rowNum) of 2.  This works 
fine.  But lets say that we just want to obtain the rank of a particular 
user (in this case 4).  I try this sql command, which just wraps the result 
in another sub query with a where clause: 

SELECT * from (select *, rownum as rn from (select userId, score from 
scores ORDER BY score DESC)) WHERE userId=4;

But here, we get the rowNum (as rn) of userId as 1.  Perhaps I am missing 
something here.  Any ideas?

Thanks,

-Adam




On Sunday, March 17, 2013 2:25:46 PM UTC-4, Thomas Mueller wrote:

 Hi,

 Could you try to provide a complete and reproducible test case that is as 
 simple as possible?

 Regards,
 Thomas



 On Wed, Feb 27, 2013 at 7:20 PM, Adam McMahon ad...@cs.miami.edujavascript:
  wrote:

 Hi,

 I am trying to get the rank of a user's score in an H2 Database.

 The following query gives me all the scores ordered descending with a 
 corresponding row number (this part works):

 *   *select *, rownum as rn from (select userId, score from nw_data 
 ORDER BY score DESC)

 But I only want to find the rank of an individual user (say userId=3), so 
 wrapped this in another select query:

select * from (select *, rownum as rn from (select userId, score 
 from nw_data ORDER BY score DESC)) WHERE userId=3;

 I would have expected this to work, but rn (the output for rownum) is 
 always 1.  It is as though the rownum function is being repeated in the 
 final outer select, when really I just want the value that was previously 
 computed.  Clearly I am missing something here.  Any ideas on how to 
 structure this?

 Thanks,

 -Adam


  -- 
 You received this message because you are subscribed to the Google Groups 
 H2 Database group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to h2-database...@googlegroups.com javascript:.
 To post to this group, send email to h2-da...@googlegroups.comjavascript:
 .
 Visit this group at http://groups.google.com/group/h2-database?hl=en.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  




-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.




getting the ROWNUM of a specific row with a WHERE

2013-02-27 Thread Adam McMahon
Hi,

I am trying to get the rank of a user's score in an H2 Database.

The following query gives me all the scores ordered descending with a 
corresponding row number (this part works):

*   *select *, rownum as rn from (select userId, score from nw_data 
ORDER BY score DESC)

But I only want to find the rank of an individual user (say userId=3), so 
wrapped this in another select query:

   select * from (select *, rownum as rn from (select userId, score 
from nw_data ORDER BY score DESC)) WHERE userId=3;

I would have expected this to work, but rn (the output for rownum) is 
always 1.  It is as though the rownum function is being repeated in the 
final outer select, when really I just want the value that was previously 
computed.  Clearly I am missing something here.  Any ideas on how to 
structure this?

Thanks,

-Adam


-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Making certain transactions more durable

2012-10-27 Thread Adam McMahon
Thanks for the reply. The H2 community is always helpful!

That makes sense with the ACCESS_MODE_DATA.

I just want to make sure that I understand how to use the CHECKPOINT 
SYNC.  Assuming I use the default durability and the defualt 
ACCESS_MODE_DATA, then I can simply call CHECKPOINT SYNC after an important 
update/insert.   And that is it?  I understand that there are still no 
absolute guarantees with this, but this seems like it should work.

My environment has pretty good power backup.





On Saturday, October 27, 2012 8:25:28 AM UTC-4, Noel Grandin wrote:

 On Sat, Oct 27, 2012 at 2:09 AM, Adam McMahon 
 ad...@cs.miami.edujavascript: 
 wrote: 
  By putting ACCESS_MODE_DATA=rws in a connection url, does that only 
 affect 
  the this connection or does that affect all connections?  If it only 
 affects 
 If it is the first connection i.e. the one that causes the database to 
 be opened, it will affect all connections. 
 Otherwise it will have no affect. 

  this connection, then I think could use 'rws' followed by a CHECKPOINT 
 SYNC 
  to get specific transactions to flush.  Would this work on specific 
  transactions while running most everything else in default mode? 
  
 You can just CHECKPOINT SYNC the stuff that is really important to you. 
 Note that 
 (1) this will affect all recently closed transactions because that 
 layer of the DB does not distinguish between data belonging to 
 different connections 
 (2) there is no guarantee that the data has actually hit the disk, 
 because most modern disks have some kind write-behind buffer. So there 
 is still a small window of data that you might lose. 

 In general, a properly configured UPS is a much better solution. 


-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/h2-database/-/-0jTzH95YYEJ.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



Making certain transactions more durable

2012-10-26 Thread Adam McMahon
I am trying to understand H2's durability and how to get improved 
durability for certain transactions.  In general I think that the 
default durability of H2 is quite appropriate for my use case (knowing that 
in a rare crash I could lose about one second of data).  But there are 
certain transactions that I would like to flush directly to disk. 

By putting ACCESS_MODE_DATA=rws in a connection url, does that only affect 
the this connection or does that affect all connections?  If it only 
affects this connection, then I think could use 'rws' followed by 
a CHECKPOINT SYNC to get specific transactions to flush.  Would this work 
on specific transactions while running most everything else in default mode?

Are there any other suggestions on how to use the default durability, and 
then also have the ability to flush specific transactions? 

Thanks,

-Adam

-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/h2-database/-/LzTrO3uPujIJ.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



Re: closing old connections from h2 console

2012-10-02 Thread Adam McMahon
Thomas,

Thanks for the feedback...

-Adam

On Sunday, September 30, 2012 12:47:35 PM UTC-4, Thomas Mueller wrote:

 Hi,

 The db_close_delay is a delay and should do what you are looking for. For 
 example db_close_delay=10 will close the database if there are no open 
 connections for 10 seconds. See also 
 http://h2database.com/html/grammar.html?highlight=DB_CLOSE_DELAYsearch=db_close#set_db_close_delay

 Regards,
 Thomas


 On Thu, Sep 27, 2012 at 3:28 PM, Adam McMahon ad...@cs.miami.edujavascript:
  wrote:

 Hi,

 I am using H2 embedded in a web app with db_close_delay=-1.  The code in 
 my app closes connections fine.  However, on occasion we use the h2 web 
 console to manage things.  Since it is in a web browser, on occasion we 
 close the browser while forgetting to hit the disconnect button (I know, 
 human error... but we are used to simply closing browsers when we are done 
 with them).   This leaves a few connections that seem to stick around for a 
 while.  Is there a way I can run either a function or sql command to clean 
 up connections that have been around for a period of time?

 Another possible idea is to add an onUnload event to the console html 
 that send a quick ping to servlet to close the connection.  I might just 
 add this if there is not a good solution.

 -Adam

 -- 
 You received this message because you are subscribed to the Google Groups 
 H2 Database group.
 To view this discussion on the web visit 
 https://groups.google.com/d/msg/h2-database/-/1_xsS7F2vqkJ.
 To post to this group, send email to h2-da...@googlegroups.comjavascript:
 .
 To unsubscribe from this group, send email to 
 h2-database...@googlegroups.com javascript:.
 For more options, visit this group at 
 http://groups.google.com/group/h2-database?hl=en.




-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/h2-database/-/r2ZPLYWGnxQJ.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



closing old connections from h2 console

2012-09-27 Thread Adam McMahon
Hi,

I am using H2 embedded in a web app with db_close_delay=-1.  The code in my 
app closes connections fine.  However, on occasion we use the h2 web 
console to manage things.  Since it is in a web browser, on occasion we 
close the browser while forgetting to hit the disconnect button (I know, 
human error... but we are used to simply closing browsers when we are done 
with them).   This leaves a few connections that seem to stick around for a 
while.  Is there a way I can run either a function or sql command to clean 
up connections that have been around for a period of time?

Another possible idea is to add an onUnload event to the console html that 
send a quick ping to servlet to close the connection.  I might just add 
this if there is not a good solution.

-Adam

-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/h2-database/-/1_xsS7F2vqkJ.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



Re: backup encrypted database

2012-02-23 Thread Adam McMahon
Thomas,

Thanks for pointing that out, I did not realize that SCRIPT allowed
that.  Your solution will work fine.  Thanks again!

On Feb 22, 11:44 pm, Thomas Mueller thomas.tom.muel...@gmail.com
wrote:
 Hi,

 I would use the script statement; it does does support an encrypted
 target:http://h2database.com/html/grammar.html#script

 It's true that the backup statement doesn't encrypt the output file
 directly; in theory you could use the encrypting file system
 implementation, but this implementation is not complete yet.

 Regards,
 Thomas

 On Mon, Feb 20, 2012 at 8:21 PM, Adam McMahon 
 a...@cs.miami.edujavascript:;
 wrote:







  Hi H2 Group,

  I have an H2 database that I use the built in AES file encryption.  I
  would like to find a good backup solution in which the backup is also
  encrypted using the same file password

  I could copy the database file, but the database will always be
  running, so simply copying the file may not be a good solution.  And,
  if I understand the sql SCRIPT and BACKUP commands correctly they will
  not encrypt the output file.  Any ideas?

  Thanks,

  -Adam

  --
  You received this message because you are subscribed to the Google Groups

 H2 Database group. To post to this group, send email to 
 h2-database@googlegroups.comjavascript:;
 .
  To unsubscribe from this group, send email to

 h2-database+unsubscr...@googlegroups.com javascript:;. For more options, 
 visit this group at

 http://groups.google.com/group/h2-database?hl=en.









-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



backup encrypted database

2012-02-20 Thread Adam McMahon
Hi H2 Group,

I have an H2 database that I use the built in AES file encryption.  I
would like to find a good backup solution in which the backup is also
encrypted using the same file password

I could copy the database file, but the database will always be
running, so simply copying the file may not be a good solution.  And,
if I understand the sql SCRIPT and BACKUP commands correctly they will
not encrypt the output file.  Any ideas?

Thanks,

-Adam

-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



Re: Criteria if a database should be embedded

2011-11-16 Thread Adam McMahon
I don't know if there are any strict criteria for embedded vs non-
embedded.

I am running a web app using H2 in embedded mode, and it is working
fine.

I chose embedded mode for the following reasons:

a) it is faster, as connections are within the same JVM and not over
another protocol
b) simple deployment
c) saves some resources, as you do not need to run another JVM

Here are some reasons why you may not want to run in embedded mode

a)  If multiple app servers need to connect to H2
b) If your database accessed so much that it makes sense to put it on
another cpu altogether.
c) management is a bit easier because you can use the web browser
interface, but you can't easily do that when it is in embedded mode
(there is a servlet which should allow you to do this, but I have not
tested it yet).


On Nov 14, 4:11 am, cnn nagesh...@gmail.com wrote:
 What will be the criteria to decide if the database should be embeded?
 I plan to develop a web application which is essentially CRUD and
 reporting style

 thanks
 -cnn

-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



Re: Best approach for using H2 over public internet

2011-11-01 Thread Adam McMahon
I have not used H2 too long, but so far it is running great in tomcat
(embedded).  It flies on my dataset.

I would recommend just creating an jsp/servlet interface to it.



On Nov 1, 4:10 pm, Rinse Lemstra r.lems...@xso.nl wrote:
 What would be the best approach to use H2 over a public internet, in
 terms of stability and performance ?

 Wrapping JDBC in a compression-class ?

 Serverlets ?

 .?

 Thanks in advance,

 Rinse

-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



Re: order of SQL operations

2011-10-31 Thread Adam McMahon
Noel,

Thanks for the link.  But, I did not find anything on the order of the
statements (but perhaps I missed it).  Lets say that one connection is
executing and has the lock, and two others are blocked temporarily.
Then after the release, one of the other two will get access and
perhaps lock the Database?  But which one will get access?  That is
what I am trying to understand.  Will the SQL statement that was
submitted first get access (is it a type of queue), or is there no
guarantee on this?

Thanks,

-Adam

On Oct 31, 1:08 am, Noel Grandin noelgran...@gmail.com wrote:
 seehttp://www.h2database.com/html/features.html#multiple_connections







 Adam McMahon wrote:
  Hi,

  Quick question.  As I understand it, H2 handles the synchronization of
  SQL commands.  If a number of SQL commands hit the database from a
  variety of connections, do they execute in the order that H2 receives
  them?  If not, can a brief explanation be provided?

  Thanks,

  -Adam

-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



Re: order of SQL operations

2011-10-31 Thread Adam McMahon
That makes sense regarding there being no grantee on the order of the
operations.

As an extension of the question, I am wondering about the clustering
of H2.  It seems that non-read only statements are sent to both
databases (and there are clear limitations as outlined in the docs).
While I have not looked at the code, it seems that the update executes
are simply run on all nodes, but will that always lead to the same
database?

Take for example, a simple update that changes an value.  Two
statements are executed in parallel by two different connections.  The
connection A sets the value to 1, and connection B sets the value to
2.  In a cluster, the statements are executed on both nodes, but since
we can't guarantee the order of the statements (as previously
discussed), it seems that it is possible that nodes in the cluster
might have different values for that data (depending on which
statement executes first).  One node might have 1 as the value, but
the other could have 2?  Is this correct?  Or is something else going
on in the clustering to prevent this from occurring.

Thanks,

-Adam


On Oct 31, 11:20 am, Noel Grandin noelgran...@gmail.com wrote:
 There is no guarantee. But that is the case with pretty much every SQL
 database engine out there.

 Note also that there is no global lock. Transactions will acquire
 row-level, and perhaps table-level locks, so two or more connections
 can actually execute at the same time.







 On Mon, Oct 31, 2011 at 18:08, Adam McMahon a...@cs.miami.edu wrote:
  Noel,

  Thanks for the link.  But, I did not find anything on the order of the
  statements (but perhaps I missed it).  Lets say that one connection is
  executing and has the lock, and two others are blocked temporarily.
  Then after the release, one of the other two will get access and
  perhaps lock the Database?  But which one will get access?  That is
  what I am trying to understand.  Will the SQL statement that was
  submitted first get access (is it a type of queue), or is there no
  guarantee on this?

  Thanks,

  -Adam

  On Oct 31, 1:08 am, Noel Grandin noelgran...@gmail.com wrote:
  seehttp://www.h2database.com/html/features.html#multiple_connections

  Adam McMahon wrote:
   Hi,

   Quick question.  As I understand it, H2 handles the synchronization of
   SQL commands.  If a number of SQL commands hit the database from a
   variety of connections, do they execute in the order that H2 receives
   them?  If not, can a brief explanation be provided?

   Thanks,

   -Adam

  --
  You received this message because you are subscribed to the Google Groups 
  H2 Database group.
  To post to this group, send email to h2-database@googlegroups.com.
  To unsubscribe from this group, send email to 
  h2-database+unsubscr...@googlegroups.com.
  For more options, visit this group 
  athttp://groups.google.com/group/h2-database?hl=en.

-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



order of SQL operations

2011-10-30 Thread Adam McMahon
Hi,

Quick question.  As I understand it, H2 handles the synchronization of
SQL commands.  If a number of SQL commands hit the database from a
variety of connections, do they execute in the order that H2 receives
them?  If not, can a brief explanation be provided?

Thanks,

-Adam

-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



Re: closing embedded database with DB_CLOSE_DELAY=-1

2011-10-26 Thread Adam McMahon
Hi,

Thomas: your suggestion to use the sql shutdown command worked great

Thotheolh: I guess my question was a bit off, because I thought I
would need an api call, but as it turns out the shutdown sql
statement worked fine.  To describe my situation.  I am using embedded
H2 in tomcat.  When I would shut down tomcat (using the tomcat
shutdown.sh command) it would give me the warning that and H2 thread
has failed to stop, it would also give me this warning upon a
redeployment.  I simply needed to add the sql shutdown command at an
appropriate place within my servlets to explicitly tell H2 to just
down.  Do you think this was not necessary?  Should I not have to do
this?

Thanks,

-Adam

On Oct 25, 11:10 pm, Thomas Mueller thomas.tom.muel...@gmail.com
wrote:
 Hi,

 To close the database, execute the SQL statement SHUTDOWN
 (Statement.execute(SHUTDOWN)).

 Regards,
 Thomas







 On Wednesday, October 26, 2011, Adam McMahon wrote:
  Hi everyone,

  I am using an embedded Database with DB_CLOSE_DELAY=-1.  I could not
  find a simple way to close this type of database from within Java
  code.

  I would like H2 to be able to close a bit more graceful, currently I
  am getting the tomcat warning: appears to have started a thread named
  [H2 File Lock Watchdog /home/adam/mydb.lock.db] but has failed to stop
  it.

  I do not want to make the Database a resource that is handled by
  tomcat, but I would like to open and close it via code.  Of course
  opening it is easy, but can't figure out how to close it when I want
  to.

  Thanks,

  -Adam

  --
  You received this message because you are subscribed to the Google Groups
  H2 Database group.
  To post to this group, send email to 
  h2-database@googlegroups.comjavascript:;
  .
  To unsubscribe from this group, send email to
  h2-database+unsubscr...@googlegroups.com javascript:;.
  For more options, visit this group at
 http://groups.google.com/group/h2-database?hl=en.

-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



var/char memory usage

2011-10-25 Thread Adam McMahon
Hi,

I am new to this list.  H2 seems like a great program and I am highly
considering using it in my current web app.

In the documentation on var/chars and I saw that The whole text is
kept in memory when using this data type.  I was confused as to what
this statement meant?

a) Does it mean that when the database loads, all var/chars are loaded
into memory and kept in memory until the database closes?  (so if have
80,000 user names, are all kept in memory?)

b) Or, does it mean that H2 keeps the var/chars in memory when
performing internal operations, and puts them in H2's cache (which can
then be recycled out when no longer needed).

c) or is it something else other than the above?

thanks,

-Adam

-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



Re: var/char memory usage

2011-10-25 Thread Adam McMahon
Thanks for the quick answer!  H2 is great!

-Adam

On Oct 25, 10:18 am, Thomas Mueller thomas.tom.muel...@gmail.com
wrote:
 Hi,

 In the documentation on var/chars and I saw that The whole text is

  kept in memory when using this data type.  I was confused as to what
  this statement meant?

 I will replace the sentence with The whole text is loaded into memory when
 using this data type.

 a) Does it mean that when the database loads, all var/chars are loaded

  into memory and kept in memory until the database closes?  (so if have
  80,000 user names, are all kept in memory?)

 No.

  b) Or, does it mean that H2 keeps the var/chars in memory when
  performing internal operations, and puts them in H2's cache (which can
  then be recycled out when no longer needed).

 Yes.

 Regards,
 Thomas

-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



closing embedded database with DB_CLOSE_DELAY=-1

2011-10-25 Thread Adam McMahon
Hi everyone,

I am using an embedded Database with DB_CLOSE_DELAY=-1.  I could not
find a simple way to close this type of database from within Java
code.

I would like H2 to be able to close a bit more graceful, currently I
am getting the tomcat warning: appears to have started a thread named
[H2 File Lock Watchdog /home/adam/mydb.lock.db] but has failed to stop
it.

I do not want to make the Database a resource that is handled by
tomcat, but I would like to open and close it via code.  Of course
opening it is easy, but can't figure out how to close it when I want
to.

Thanks,

-Adam

-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.