Showing posts with label teh. Show all posts
Showing posts with label teh. Show all posts

Wednesday, March 21, 2012

Microsoft JDBC driver support connection pooling out of the box

Hi,
I'm pretty new to JDBC so bare with me.
If using Jdbc outside of an application/J2ee server with the Microsoft
Jdbc driver what is teh correct procedure/code for ensuring
connections are pooled.
I've seen quite a few posts about this but to be honest mostly of
little use.
A code snippet would be great.
Some of my colleagues have saud you don't get pooling without a
application/J2ee server , is this correct?
Regards
John Harkin wrote:

> Hi,
> I'm pretty new to JDBC so bare with me.
> If using Jdbc outside of an application/J2ee server with the Microsoft
> Jdbc driver what is teh correct procedure/code for ensuring
> connections are pooled.
> I've seen quite a few posts about this but to be honest mostly of
> little use.
> A code snippet would be great.
> Some of my colleagues have saud you don't get pooling without a
> application/J2ee server , is this correct?
> Regards
Some drivers will offer an internal poooing feature, which can be
useful for long-running applications that use lots of connections,
opening and closing them frequently. If the app is short-lived,
or just opens connections and keeps them until it exits, then
pooling won't help.
In any case, the free MS driver has no internal connection pooling.
Joe Weinstein at BEA

Wednesday, March 7, 2012

Meta Database Design Select Question.

Hi,

I have a Datbase with teh following two tables.

Table 1: default_en_listingsdb
it contains the following fields
ID user_ID Title

Table2:
default_en_listingsdbelements
ID field_name field_value listing_id

listing_ID in table 2 is equal to the ID in table 1.

I am building a search for these two tables where i want to return the ID, user_ID and Title. The table data looks like this.

Table 1:
ID user_ID Title
1 1 Test
2 2 Test2

Table2:
ID field_name field_value listing_id
1 beds 2 2
2 beds 1 1
3 city kingsley 1
4 city kingsley 2

I want to return only the ID's where they contain both beds = 2 and city = kingsley.. I want to do this with on e select statement if possible.

Thanks,I hate this, what Tom Kyte calls the "funky data model". Flexible as you like, but so hard to query (and this is a very simple query!)

Also, data integrity is non-existent, because there can be no database constraint that stops you putting 2 for city or kingsley for beds...

Anyway... </RANT>

select t1.*
from table1 t1, table2 beds, table2 city
where t1.id = beds.listing_id
and beds.field_name = 'beds'
and beds.field_value = '2'
and city.field_name = 'city'
and city.field_value = 'kingsley';

Yuk!|||Thanks, I knew it was going to be ugly, i agree that this data model in some ways really sucks... ohh well off to make this work.. Thanks again|||Originally posted by greengaint
Thanks, I knew it was going to be ugly, i agree that this data model in some ways really sucks... ohh well off to make this work.. Thanks again
Everyone "invents" this data model at some point early in their database careers; well, I'm sure I did once anyway. "Hey, look! With this model we don't have to alter tables or application code ever again! The users can just define their own 'fields' whenever they like!" Then later you find that:
(a) performance sucks very badly, and
(b) you need to write SQL 17 pages long to produce the simplest report, and
(c) the data is full of nonsense like beds='4.2' and city = ' kignsley' and startdate = '31 Feb 2004'... and
(d) nobody likes this system any more