在本课中,您将建立统一数据库进行同步。
运行以下命令创建统一数据库,并使其开始运行:
md c:\cons cd c:\cons dbinit consol.db dbeng12 consol.db |
运行以下命令定义统一数据库的 ODBC 数据源:
dbdsn -w dsn_consol -y -c "uid=DBA;pwd=sql;dbf=consol.db;server=consol" |
要将数据库用作统一数据库,必须运行一个安装脚本,此脚本添加 MobiLink 使用的系统表、视图和存储过程。以下命令将 consol.db 设置为统一数据库:
dbisql -c "dsn=dsn_consol" %SQLANY12%\MobiLink\setup\syncsa.sql |
打开 Interactive SQL 并使用 dsn_consol DSN 连接到 consol.db。
dbisql -c "dsn=dsn_consol" |
运行下面的 SQL 语句。这些语句在统一数据库上创建 customer 表,然后创建所需的同步脚本。
CREATE TABLE customer ( id unsigned integer primary key, name varchar( 256), phone varchar( 12 ) ); CALL ml_add_column('my_ver1', 'customer', 'id', null ); CALL ml_add_column('my_ver1', 'customer', 'name', null ); CALL ml_add_column('my_ver1', 'customer', 'phone', null ); CALL ml_add_table_script( 'my_ver1', 'customer', 'upload_insert', 'INSERT INTO customer ( id, name, phone ) ' || 'VALUES ({ml r.id}, {ml r.name}, {ml r.phone} )' ); CALL ml_add_table_script( 'my_ver1', 'customer', 'download_cursor', 'SELECT id, name, phone from customer' ); CALL ml_add_table_script( 'my_ver1', 'customer', 'download_delete_cursor', '--{ml_ignore}' ); COMMIT; |
执行此 SQL 后,使 Interactive SQL 处于运行状态,并连接到数据库,因为随着课程的深入您将对此数据库运行更多的 SQL。
运行以下命令,即可启动 MobiLink 服务器:
start mlsrv12 -c "dsn=dsn_consol" -v+ -ot mlsrv.txt -zu+ |
![]() |
使用DocCommentXchange 讨论此页。
|
版权 © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0 |