Topic: 在java中如何实现同时对sqlserver中的多个库的查询啊?

  Print this page

1.在java中如何实现同时对sqlserver中的多个库的查询啊? Copy to clipboard
Posted by: suntrees
Posted on: 2004-10-19 15:38

偶不会啊,求各位救命啊!

2.Re:在java中如何实现同时对sqlserver中的多个库的查询啊? [Re: suntrees] Copy to clipboard
Posted by: why
Posted on: 2004-10-19 17:11

Why would you like to do this?
Please tell us the context...

3.Re:在java中如何实现同时对sqlserver中的多个库的查询啊? [Re: suntrees] Copy to clipboard
Posted by: hohaischooldays
Posted on: 2004-10-19 17:19

"同时"到什么程度,是一个查询?

4.Re:在java中如何实现同时对sqlserver中的多个库的查询啊? [Re: suntrees] Copy to clipboard
Posted by: scud
Posted on: 2004-10-19 17:21

ADB..ATable
BDB..BTable

5.Re:在java中如何实现同时对sqlserver中的多个库的查询啊? [Re: suntrees] Copy to clipboard
Posted by: suntrees
Posted on: 2004-10-19 18:16

比如我想从a库的a表中和b库的b表中取出所有的数据,请问sql语句应该怎么写?
是不是这样:
select * from a..a
union all
select * from b..b啊?

我怎么试了不行呢?

6.Re:在java中如何实现同时对sqlserver中的多个库的查询啊? [Re: suntrees] Copy to clipboard
Posted by: mozilla
Posted on: 2004-10-20 10:51

你两个表的结构完全相同吗?

7.Re:在java中如何实现同时对sqlserver中的多个库的查询啊? [Re: suntrees] Copy to clipboard
Posted by: hohaischooldays
Posted on: 2004-10-20 17:35

我个人认为这样在一个查询中进行两个数据库中查询是不可能的,可以这样想啊,我们在查询前一定要建立数据库连接,当我们建立另一个数据库连接时前一个数据库连接已经丢失,在当前连接下查询前一个数据库中的表应该是不可能的!(个人意见,仅供参考)

8.Re:在java中如何实现同时对sqlserver中的多个库的查询啊? [Re: scud] Copy to clipboard
Posted by: hohaischooldays
Posted on: 2004-10-20 17:38

scud wrote:
ADB..ATable
BDB..BTable

scud老兄,你说的清楚一点嘛!

9.Re:在java中如何实现同时对sqlserver中的多个库的查询啊? [Re: suntrees] Copy to clipboard
Posted by: suntrees
Posted on: 2004-10-20 18:15

我已经会了,呵呵
例如,如果想在第一个链接中查B库的数据,SQL语句可以这样写:
select * from a..a.a,b..b.b,这样就可以了!我已经试过了

10.Re:在java中如何实现同时对sqlserver中的多个库的查询啊? [Re: suntrees] Copy to clipboard
Posted by: hohaischooldays
Posted on: 2004-10-21 23:18

啊,是不是只有sqlserver可以啊,我在oracle和DB2中怎么都不行啊,根本就不认识那个..

无知中啊,汗颜!

11.Re:在java中如何实现同时对sqlserver中的多个库的查询啊? [Re: suntrees] Copy to clipboard
Posted by: qq6600
Posted on: 2004-10-24 10:31

新手,也在迷茫中,希望老手指点迷经。

12.Re:在java中如何实现同时对sqlserver中的多个库的查询啊? [Re: suntrees] Copy to clipboard
Posted by: sgc_hy
Posted on: 2004-11-05 16:33

看不明!

13.Re:在java中如何实现同时对sqlserver中的多个库的查询啊? [Re: suntrees] Copy to clipboard
Posted by: secretescapeby
Posted on: 2004-11-05 20:39

好像是不行的吧


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923