从数据库中搜索数据..?
我有一个关于患者计费系统的项目,这是一个组织的网站。 我使用technologie jsp和java来开发这个......
在这个系统中我有不同的组织,每个组织都有它自己的数据库 我没有为这个系统维护任何中央数据库。 在这方面,我的要求是搜索必须由组织明智地完成。
例如,如果我们想知道每个组织中可用的床位数量,那么它有 给出了组织明智的可用床位数量的结果......
我的想法是将组织静态 IP 保存在我的中央数据库中 然后在需要时查询数据库..
在这方面我也有疑问.. 是否可以同时查询不同的数据库...?
请为我的问题提供任何解决方案...
提前致谢...
i have a project about patient billingsystem which is a website to a organization..
and i use technologie jsp and java to develop this....
in this system i have different organizations and each organization has it's own database
and i didn't maintain any central database for this system..
and in this my requirement is seraching must be done by the organization wise..
for example if we want to know the no of beds is available in each organization then it has
gives the result no of beds available by organization wise....
and my thought is that save the organization static ip in my central database
and then query on the database when we require..
In this also i have a doubt that..
is it possible to query on different databases on at a time...??
please give me any solution for my problem....
thanks in advance...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果IP是你必须做的一切,我想你必须这样做。
我想你最好点击主机名,因为它改变的可能性要小得多。
至于访问不同的数据库,您必须与每个数据库建立连接(尽管您可以根据大小对它们进行集群,拥有几个超级节点来访问处于该状态的所有数据库或进行并行化) )但这很容易做到。我的意思是,它几乎就这么简单(从逻辑上讲,显然你不能复制/粘贴它。)
If IP is all you have to go on, I guess you have to do it.
I imagine you'd be better off hitting the hostname, since the it's a lot less likely to change.
As far as hitting the different databases, you'll have to make a connection to each one (although it's possible you could cluster them, depending on size, having a couple super nodes that hit all the ones in that state or something to parallelize it) but it's pretty easy to do. I mean, it's almost as simple as this (logically, obviously you can't copy/paste this.)
我不知道有任何 DBMS 可以让您执行一次查询来访问多个数据库模式。您的两个最佳选择是:
哪个对您更有效受多种因素的影响。
I don't know of any DBMSs that would let you do a single query that hits multiple database schemas. Your two best options are:
Which will work better for you is affected by several factors.
这取决于你的意思。
如果数据库都使用相同的模式、表名和 SQL 方言,并且您不进行更新,并且不需要原子查询,则可以简单地保留一个到不同数据库的数据库连接池,然后发送对每个数据库进行相同的查询,然后手动合并从结果集中提取的内容。
如果数据库模式(或只是表名称)不同,则 1) 您必须发送不同的查询,2) 合并结果可能会很繁琐。
如果数据库使用不同的 SQL 方言,您还必须处理 SQL 语法、列类型和潜在语义的差异。
跨多个数据库的原子查询和更新很困难。您需要使用支持分布式事务的分布式数据库层。
关于联合数据库系统的维基百科文章可能会帮助您了解一些问题。
It depends on what you mean.
If the databases all use the same schemas, table names and SQL dialect, and if you are not doing updates, and you don't need atomic queries, you can simply keep a pool of database connections to different databases, send the same query to each database, and then manually merge the stuff you pull from the resultsets.
If the database schemas (or just the table names) are different, then 1) you have to send different queries, and 2) merging the results may be fiddly.
If the databases use different SQL dialects, you've also got to deal with differences in SQL syntax, column types, and potentially semantics.
Atomic queries and updates across multiple databases are hard. You need to use a distributed database layer that supports distributed transactions.
The Wikipedia article on Federated Database Systems may help you understand some of the issues.