在2种不同类型的数据库之间共享1个表

发布于 2024-10-09 22:46:12 字数 194 浏览 1 评论 0原文

我遇到的问题是我想在两个不同的数据库之间同步一个表。 数据库 1 位于带有 MySQL 的 XP 服务器上 数据库 2 位于装有 Clarion 的 Novell 服务器上。

两个数据库之间是否可以共享一张表用户? 因此,当数据放入数据库 1 时,数据库会自动与数据库 2 同步。完成此操作后,表:两个数据库中的用户是否相同?

提前致谢!

The problem that I have is that I want to synchronize one table between two different databases.
Database 1 is on a XP server with MySQL
Database 2 is on a Novell server with Clarion.

Is it possible to share one table users between the two databases?
So when data is put in database 1, the database automatically synchornize with database 2. When this is done the table: user is in both databases the same?

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

以为你会在 2024-10-16 22:46:12

Diederik,

您的问题不是很清楚,因为我们不知道您是否有权访问源代码或只能在数据库级别进行操作。

您没有明确提及是否使用 Clarion 来驱动这些数据库。我假设你是,因为你用它标记了你的帖子。

另外,您没有提及您在 Novell 服务器上使用的文件格式。我假设您正在使用 TopSpeed 文件格式 - 这里有一些有关 TopSpeed 文件格式的信息:大多数程序员认为它是 Clarion for Windows 的“本机”文件格式。它不是。 Windows 版 Clarion 没有本机文件格式之类的东西,而是采用完全驱动程序驱动的方法。 Clarion Professional Developer(DOS IDE)具有本机文件格式,即 Clarion .DAT 格式。 Clarion for Windows 可以使用提供驱动程序或 ODBC 驱动程序的任何文件格式,包括旧的 .DAT。

如果您可以访问源代码,那么情况就很简单了。在 Clarion 中,您可以轻松地让不同的缓冲区指向不同的表。

                PROGRAM

            MAP
            END

szConnMySQL     CSTRING( 256 )

users_mysql     FILE, DRIVER( 'ODBC' ), OWNER( szConnMySQL ), NAME( 'users' )        
RECORD            RERCORD                                                            
id                  LONG                                                             
name                STRING( 20 )                                                     
                  END
                END

users_tps       FILE, DRIVER( 'TopSpeed' ), NAME( 'users' )        
RECORD            RECORD                                           
name                STRING( 20 )                                   
id                  LONG                                           
                  END                                                
                END


            CODE

            szConnMySQL = 'Driver={{MySQL ODBC 3.51 Driver};' & |
              'Server=myServerAddress;Database=myDataBase;User=myUsername;' & |
              'Password=myPassword;Option=3;'

            OPEN( users_mysql, 42h )
            OPEN( users_tps, 42h )

            users_mysql.id = 1
            users_mysql.name = 'GUSTAVO PINSARD'
            ADD( users_mysql )
            IF NOT ERRORCODE()
              users_tps.RECORD :=: users_mysql.RECORD
              ADD( users_tps )

            ELSE
              ! Do your thing
            END

            CLOSE( users_mysql )
            CLOSE( users_tps )                

如果您无法访问源代码,则必须编写 MySQL 存储过程来更新远程文件。问题是,作为 TopSpeed 文件的远程文件将无法从 MySQL 服务器直接访问,因为 MySQL 服务器对此一无所知。

克服此问题的一种解决方案是在 MySQL 服务器上使用 TopSpeed ODBC 驱动程序,并让 MySQL SP 访问 ODBC 驱动程序。我认为 TopSpeed ODBC 驱动程序是必须的,因为它允许采取一种策略来避免这种情况,并促进更好的集成。

有关 MySQL SP 的详细信息超出了本文的范围,也是因为我不知道该级别的 MySQL SP。

问候

Diederik,

Your question isn't very clear in that we don't know if you have access to the source code or can only operate on a database level.

You didn't mention clearly if you're using Clarion to drive those databases. I'm assuming you are, since you tagged your post with it.

Also, you didn't mention which file format you're using at the Novell server. I'm assuming you are using the TopSpeed file format - here a bit of information about the TopSpeed file format: most programmers think it is the "native" file format for Clarion for Windows. It is not. Clarion for Windows doesn't have such thing as a native file format, but employs a totally driver driven approach. Clarion Professional Developer (a DOS IDE) had a native file format, which was the Clarion .DAT format. Clarion for Windows can use whatever file format that offers a driver or ODBC driver, including the old .DAT.

If you have access to the source code, then it is a pretty straight situation. In Clarion you can easily have different buffers pointing to different tables.

                PROGRAM

            MAP
            END

szConnMySQL     CSTRING( 256 )

users_mysql     FILE, DRIVER( 'ODBC' ), OWNER( szConnMySQL ), NAME( 'users' )        
RECORD            RERCORD                                                            
id                  LONG                                                             
name                STRING( 20 )                                                     
                  END
                END

users_tps       FILE, DRIVER( 'TopSpeed' ), NAME( 'users' )        
RECORD            RECORD                                           
name                STRING( 20 )                                   
id                  LONG                                           
                  END                                                
                END


            CODE

            szConnMySQL = 'Driver={{MySQL ODBC 3.51 Driver};' & |
              'Server=myServerAddress;Database=myDataBase;User=myUsername;' & |
              'Password=myPassword;Option=3;'

            OPEN( users_mysql, 42h )
            OPEN( users_tps, 42h )

            users_mysql.id = 1
            users_mysql.name = 'GUSTAVO PINSARD'
            ADD( users_mysql )
            IF NOT ERRORCODE()
              users_tps.RECORD :=: users_mysql.RECORD
              ADD( users_tps )

            ELSE
              ! Do your thing
            END

            CLOSE( users_mysql )
            CLOSE( users_tps )                

If you don't have access to source code, then you'll have to write a MySQL stored procedure to update the remote file. The problem is that the remote file, being a TopSpeed file, would bot be directly accessible from the MySQL server, since it, MySQL, doesn't know anything about it.

One solution to overcome this is by using the TopSpeed ODBC driver at the MySQL server, and having the MySQL SP access the ODBC driver. I consider the TopSpeed ODBC driver a must have, because it allows for a strategy to escape such situations, and promote a better integration.

Details on the MySQL SP are out of the scope of this post, also because I don't know MySQL SPs to that level.

Regards

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文