If I create a database with url
jdbc:h2:tcp://localhost/fOo
a file named fOo.h2.db is created
Inside the database that db is referred to as catalog FOO
If I at somepoint try to connect to the database with string that I have
received
either from connection.getCatalog() or from DATABASE() function I get an
error
because there exists no FOO.h2.db.
So since the catalog and database name are case insensitive (all uppercase)
I think the file name should be too.
- rami
--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To post to this group, send email to h2-da...@googlegroups.com.
To unsubscribe from this group, send email to h2-database...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
> a file named fOo.h2.db is created
> Inside the database that db is referred to as catalog FOO
Why do you need the catalog? It is supported for compatibility (with
OpenOffice as far as I remember).
> So since the catalog and database name are case insensitive (all uppercase)
> I think the file name should be too.
No, I think that's not required.
Regards,
Thomas
I wanted to make a connection to the same database where the code is
executing.
So to construct a connection url I wrote jdbc:h2:tcp://localhost/ + CATALOG
I assume the terminology goes like this
CATALOG = DATABASE
And DATABASE() function also returns the name in all uppercase.
So if I have named my database in mixed case there is no programmatic way to
figure out the url to the current database.
> No, I think that's not required.
Heh. I like your style. Compact ;-)
I have had already problems writing sometimes the database name
somewhere all lowercase
and somewhere in all uppercase and wondered, where have the
tables,updates etc disappeared.
I think it is a very rare case that someone would need the ability to
have databases named
so that they only differ in their casing.
Also this would bring consistency between operating systems.
So I see only plusses in this one.
But I have to admit that you are right. It is not required. :-D
- rami
> I wanted to make a connection to the same database where the code is
> executing.
There is a method in the JDBC API: DatabaseMetaData.getURL(). But
somethings this URL is not the 'real' URL (in Java functions).
From where do you need a new connection? From the trigger? If yes,
there is already a connection available in the trigger, why do you
need another one?
Regards,
Thomas
Do you mean that it's unusable or that it is mostly usable but has one or two
ways that it can lie? Anyway to connect one needs username and password and
that can never be retrieved from anywhere. So the url needs to be hardcoded
anyways. My thought continues in the second answer below...
>
> From where do you need a new connection? From the trigger? If yes,
> there is already a connection available in the trigger, why do you
> need another one?
I need the connection in Trigger's close() and remove() methods.
I think I mentioned this in an earlier mail.
How am I supposed to do cleanup if I don't have a connection to the database?
- rami
Why did you write function DATABASE()?
It returns the name of catalog (or should I say database?).
And it returns it in all uppercase.
Now why would it do that?
Because clearly the url to connect to it does not think that is the name of the
database (if the file has lowercase letters).
And why in the information_schema tables the catalog name is mentioned
everywhere? Clearly it can have only one value everywhere. The name of the
database. Of course it is for compatibility you say.
But trust me. If you make a definate decision (or should I say conceptual
clarification) that x is what catalog means and y is what database means then it
is so much simpler for users to use the software.
In addition of having clear meanings one needs also clear syntax rules.
So if DATABASE() returns the name of the database in all uppercase then
that value should work everywhere where a reference to that database is made.
Right? I think the reason here would be called consistency.
>
>> So since the catalog and database name are case insensitive (all uppercase)
>> I think the file name should be too.
>
> No, I think that's not required.
Jolly Good!
It certainly is not required but it is desired :-)
Think about this use case.
Someone has 3 databases on linux and wants to move them on windows.
Oh but he can't.
What is the benefit of keeping database names case-sensitive?
- rami
> I need the connection in Trigger's close() and remove() methods.
> How am I supposed to do cleanup if I don't have a connection to the
> database?
You can use the connection you got in the "init" method.
> Why did you write function DATABASE()?
I don't remember. Actually, now I would probably not write such a
method, and instead add it to information_schema.settings.
> And why in the information_schema tables the catalog name is mentioned everywhere?
For compatibility with other databases.
> I think the file name should be [uppercase].
> It certainly is not required but it is desired :-)
No. I don't like all uppercase file names.
> Someone has 3 databases on linux and wants to move them on windows.
> Oh but he can't.
Sure he can.
> What is the benefit of keeping database names case-sensitive?
You mean file names?
Regards,
Thomas