如何处理多个数据库访问?
在我的程序中,我有多个数据库。一种是固定的,不能改变,但也有一些其他的,即所谓的用户数据库。 我想现在我必须为每个数据库启动一个连接并连接到每个数据字典。怎么通过交出数据字典文件名,一个连接就能连接多个数据库呢?顺便提一句。我正在使用本地服务器。
非常感谢,
André
P.S.:好的,我可能会找到问题的答案。 关键字是 CreateDDLink。该过程正在连接到另一个数据字典,但在此之前必须设置主字典。
In my program I have multiple databases. One is fixed and cannot be changed, but there are also some others, the so called user databases.
I thought now I have to start for every database one connection and to connect to each data dictionary. How is it possible to connect to more than one database with one connection by handing over the data dictionary filename? Btw. I am using a local server.
thank you very much,
André
P.S.: Okay I might find the answer to my problem.
The Key word is CreateDDLink. The procedure is connecting to another data dictionary, but before a master dictionary has to be set.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如您在问题中指出的那样,链接可能就是您正在寻找的内容。您可以使用 API 或 SQL 创建永久链接别名,也可以动态动态创建链接。
我建议查看此特定帮助文件页面: 使用来自 永久别名的多个数据字典
(使用 SQL)请查看 sp_createlink。您可以创建链接来验证当前用户的身份,也可以设置链接来验证特定用户的身份。然后在 SQL 语句中使用链接名称。
select * from linkname.tablename
或者动态地您可以使用以下内容来验证当前用户:
select * from "..\dir\otherdd.add".table1
但是,链接仅适用于 SQL。如果您想直接使用该表(即通过 TAdsTable 组件),您将需要创建视图。请参阅知识库 080519-2034。该知识库提到,如果视图的 SQL 语句导致静态游标,则无法发布更新,但您可以通过在视图上创建触发器来解决这个问题。
Links may be what you are looking for as you indicated in the question. You can use the API or SQL to create a permanent link alias, or you can dynamically create links on the fly.
I would recomend reviewing this specific help file page: Using Tables from Multiple Data Dictionaries
for a permanent alias (using SQL) look at sp_createlink. You can either create the link to authenticate the current user or set up the link to authenticate as a specific user. Then use the link name in your SQL statements.
select * from linkname.tablename
Or dynamically you can use the following which will authenticate the current user:
select * from "..\dir\otherdd.add".table1
However, links are only available to SQL. If you want to use the table directly (i.e. via a TAdsTable component) you will need to create views. See KB 080519-2034. The KB mentions you can't post updates if the SQL statement for the view results in a static cursor, but you can get around that by creating triggers on the view.