Thomas,
don't worry , I want only one copy of every Jdbc Driver loaded no
matter how many TABLE LINK are created.
And if there are not fancy classLoaders we can be sure that only one
driver will be loaded per H2 instance.
I have tested a db with 8 Linked tables created to a DB2, and monitoring
connections I found that by default linked tables don't share connections.
In my test case exactly 8 connections was established.
Reviewing src I found a simple misspelling in your code, in class:
/svn/trunk/h2/src/main/org/h2/table/*TableLinkConnection.java
*
public static TableLinkConnection *open(*HashMap map, String driver, String
url, String user, String password) throws SQLException {
TableLinkConnection t = new TableLinkConnection(map, driver, url, user,
password);
* if (SysProperties.SHARE_LINKED_CONNECTIONS) {*
t.open();
return t;
}
synchronized (map) {
TableLinkConnection result;
result = (TableLinkConnection) map.get(t);
if (result == null) {
synchronized (t) {
t.open();
}
// put the connection in the map after is has been opened,
// so we know it works
map.put(t, t);
result = t;
}
synchronized (result) {
result.useCounter++;
}
return result;
}
}
I think that comparison must be negated like this: **
if ( *! ***SysProperties.SHARE_LINKED_CONNECTIONS) {
**Testing again with this change, I can assert that only one connection
was opened and all goes well.
Now DB starting time was reduced in a 4 to 1 ratio or more .
Regards,
Dario Fassi.
Thomas Mueller escribió:
> Hi,
>
>
>> can I be sure that only one copy of JDBC driver will be loaded ?
>> Yes it's, my question is if there are some specialized ClassLoader for
>> isolation of connection/JdbcDriver in a per table basis (like WebSphere
>> does for conectors).
>>
>
> There is no such feature. There is however a way to use a data source
> instead of a JDBC driver:
>
> To use JNDI to get the connection, the driver class must be a
> javax.naming.Context (for example javax.naming.InitialContext), and
> the URL must be the resource name (for example
> java:comp/env/jdbc/Test).
>
> Example:
> CREATE LINKED TABLE LINK('javax.naming.InitialContext',
> 'java:comp/env/jdbc/Test', NULL, NULL, '(SELECT * FROM TEST WHERE ID>0)');
>
> I will document that in the next release.
>
> 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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en
-~----------~----~----~----~------~----~------~--~---