Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JDBC - multiple database

Reply
Thread Tools

JDBC - multiple database

 
 
cmk128@hotmail.com
Guest
Posts: n/a
 
      02-23-2007
Hi
If i invoke a select statement through JDBC, can JDBC send that to
two different databases and combine the results for me?

thanks
from Peter ((E-Mail Removed))

 
Reply With Quote
 
 
 
 
hvt
Guest
Posts: n/a
 
      02-23-2007
On Feb 23, 9:06 am, (E-Mail Removed) wrote:
> Hi
> If i invoke a select statement through JDBC, can JDBC send that to
> two different databases and combine the results for me?
>
> thanks
> from Peter ((E-Mail Removed))


yep, this cud be done though u need to maintain two diff connection
and statement instances to invoke jdbc query on two different
databases.

 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      02-23-2007
Peter (cmk) wrote:
>> If i invoke a select statement through JDBC, can JDBC send that to
>> two different databases and combine the results for me?


hvt wrote:
> yep, this cud be done though u need to maintain two diff connection


Please don't use such terse abbreviations. "Cud" is regurgitated grass that
cattle chew. "diff" is a UNIX utility. "u" is a type of turn made by an
automobile.

> and statement instances to invoke jdbc query on two different
> databases.


That really depends on what you mean by the word "database". For example, in
systems that have a "CREATE DATABASE" command you might be able to access more
than one "DATABASE" through a single connection. Such systems refer to tables
with a "database.table" syntax. You can even refer to multiple "DATABASEs" in
the same SQL statement.

- Lew
 
Reply With Quote
 
=?UTF-8?B?QXJuZSBWYWpow7hq?=
Guest
Posts: n/a
 
      02-24-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> If i invoke a select statement through JDBC, can JDBC send that to
> two different databases and combine the results for me?


Only if the the database server the statement is connected to
via a connection supports the usage of remote/linked database
servers in its SQL dialect.

Arne
 
Reply With Quote
 
hvt
Guest
Posts: n/a
 
      02-24-2007
On Feb 24, 4:11 am, Lew <(E-Mail Removed)> wrote:
> Peter (cmk) wrote:
> >> If i invoke a select statement through JDBC, can JDBC send that to
> >> two different databases and combine the results for me?

> hvt wrote:
> > yep, this cud be done though u need to maintain two diff connection

>
> Please don't use such terse abbreviations. "Cud" is regurgitated grass that
> cattle chew. "diff" is a UNIX utility. "u" is a type of turn made by an
> automobile.
>
> > and statement instances to invoke jdbc query on two different
> > databases.

>
> That really depends on what you mean by the word "database". For example, in
> systems that have a "CREATE DATABASE" command you might be able to access more
> than one "DATABASE" through a single connection. Such systems refer to tables
> with a "database.table" syntax. You can even refer to multiple "DATABASEs" in
> the same SQL statement.
>
> - Lew


lew thx fr ur suggestion and all those dictionary explanations!!!

 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      02-24-2007
hvt wrote:
> lew thx fr ur suggestion and all those dictionary explanations!!!


THX is a format for home stereo sound.
<http://www.practical-home-theater-guide.com/thx-home-cinema.html>

Seriously, it is a good idea to practice using full words and good grammar.
here It will help you when you want to impress folks in the work world. Also
it is much easier on other people in the newsgroup, especially the
international community who may not have the immersion in American-style
cell-phone textspeak
<http://en.wikipedia.org/wiki/Newspeak>
to help them read your posts.

If your goal is to communicate. If not, then gradually you might find less and
less useful response as people give up trying to adapt to the difficult text.


Dz th hp u?

Gosh, even I don't know what I just said. LOLLIGAG. WTF?

<http://en.wikipedia.org/wiki/Leetspeak>

- Lew
 
Reply With Quote
 
Martin Gregorie
Guest
Posts: n/a
 
      02-24-2007
Lew wrote:
> Peter (cmk) wrote:
>>> If i invoke a select statement through JDBC, can JDBC send that to
>>> two different databases and combine the results for me?

>
> hvt wrote:
>> yep, this cud be done though u need to maintain two diff connection

>
> Please don't use such terse abbreviations. "Cud" is regurgitated grass
> that cattle chew. "diff" is a UNIX utility. "u" is a type of turn made
> by an automobile.
>
>> and statement instances to invoke jdbc query on two different
>> databases.

>
> That really depends on what you mean by the word "database". For
> example, in systems that have a "CREATE DATABASE" command you might be
> able to access more than one "DATABASE" through a single connection.
> Such systems refer to tables with a "database.table" syntax. You can
> even refer to multiple "DATABASEs" in the same SQL statement.
>

'hvt' is dead wrong if transaction integrity is important to the OP.

Unless you're using a transaction manager you can't guarantee that work
units on the separate databases are all either committed or rolled back.
Examples of this sort of framework are Pathway for HP's Guardian NonStop
OS, BEA's Weblogic and IBM's MQ series.

I don't think there's any such mechanism built into Java though I'll be
happy to hear that I'm wrong.


--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |
 
Reply With Quote
 
hvt
Guest
Posts: n/a
 
      02-25-2007
On Feb 24, 7:56 pm, Lew <(E-Mail Removed)> wrote:
> hvt wrote:
> > lew thx fr ur suggestion and all those dictionary explanations!!!

>
> THX is a format for home stereo sound.
> <http://www.practical-home-theater-guide.com/thx-home-cinema.html>
>
> Seriously, it is a good idea to practice using full words and good grammar.
> here It will help you when you want to impress folks in the work world. Also
> it is much easier on other people in the newsgroup, especially the
> international community who may not have the immersion in American-style
> cell-phone textspeak
> <http://en.wikipedia.org/wiki/Newspeak>
> to help them read your posts.
>
> If your goal is to communicate. If not, then gradually you might find less and
> less useful response as people give up trying to adapt to the difficult text.
>
> Dz th hp u?
>
> Gosh, even I don't know what I just said. LOLLIGAG. WTF?
>
> <http://en.wikipedia.org/wiki/Leetspeak>
>
> - Lew


lew i appreciate your and other group members concern over language
used in the forum.

Martin, as the question was posted:
can JDBC send that to two different databases...
this can be done by maintaining two different connection/statement
object. I 've tried this for searching Weblogic portal repository and
local application data through Lucene. Weblogic maintains it's portal
repository data in pointbase (default database) and local application
data was maintained in Oracle9i.
If you see any problem in this please clarify.

Now seeing this as how feasible is this approach for processing data
through multiple databases, a solid framework is required (completely
agree).

 
Reply With Quote
 
=?UTF-8?B?QXJuZSBWYWpow7hq?=
Guest
Posts: n/a
 
      02-25-2007
Martin Gregorie wrote:
> Unless you're using a transaction manager you can't guarantee that work
> units on the separate databases are all either committed or rolled back.
> Examples of this sort of framework are Pathway for HP's Guardian NonStop
> OS, BEA's Weblogic and IBM's MQ series.
>
> I don't think there's any such mechanism built into Java though I'll be
> happy to hear that I'm wrong.


All J2EE app servers has a built in transaction manager that can
handle multiple XA compliant databases.

Arne
 
Reply With Quote
 
Martin Gregorie
Guest
Posts: n/a
 
      02-26-2007
hvt wrote:
> Martin, as the question was posted:
> can JDBC send that to two different databases...
> this can be done by maintaining two different connection/statement
> object. I 've tried this for searching Weblogic portal repository and
> local application data through Lucene. Weblogic maintains it's portal
> repository data in pointbase (default database) and local application
> data was maintained in Oracle9i.
> If you see any problem in this please clarify.
>

There's no problem with simply connecting to two or more databases as
long as you're only reading them and you have no need for data
consistency between the databases.

However, if you're updating tables in one or more databases or if
updates applied to one database are dependent on the content of other
databases you have a potential problem. You can't guarantee that all
updates are either committed or rolled back without using a transaction
manager to enforce consistency across all the databases.

The downside is that a transaction within the transaction manager will
hold locks in all the databases your transaction accesses until all
databases have successfully committed the transaction. If such a
transaction is long running it can have a major impact on the
performance and response times of the underlying databases.

Note that the consistency issue arising from just connecting to several
databases (i.e. not using a transaction manager) can be a problem for BI
applications despite them being read-only: if one database is updated
while you're retrieving data it could make the data set you're analyzing
inconsistent. Visualize the situation where online stock control is
being used, but supplier and customer accounts are only updated
periodically: there's no way a BI application will get a consistent
snapshot during the day. This the reason many organizations use data
warehouses to support their BI systems. Once data is extracted from the
operational databases and loaded into a data warehouse you know its
consistent and will remain so until the next snapshot is extracted.

HTH

--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Database Database Database scott93727@gmail.com Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase scott93727@gmail.com Computer Information 0 09-26-2012 09:40 AM
stand-alone JMS, other JDBC operations, and transactions ( ActiveMQ + JOTM + JDBC operations ) Jesus M. Salvo Jr. Java 2 02-11-2006 06:33 PM
oracle.jdbc.OracleDriver vs oracle.jdbc.driver.OracleDriver Betty Java 1 05-21-2005 05:15 PM
Re: jdbc help:sun.jdbc.odbc.JdbcOdbcDriver Keith Wansbrough Java 0 08-16-2004 07:31 PM



Advertisments