cancel
Showing results for 
Search instead for 
Did you mean: 

Upgrade UDB schema using SQL file

Former Member
0 Kudos

Hi ,

Our iPad application uses UDB in iOS and Mobilink as middleware.

We used to have 4 publications. We modified it to 3 publications to improve Sync performance.

From iOS end, we upgrade UDB schema using sql file by executing below statement

ALTER DATABASE SCHEMA FROM FILE UDBSchema_v2.sql


As we removed a publication in Mobilink server, We have to drop publication at client side too. So, we added below 2 lines to drop publication and synchronization profile


DROP PUBLICATION [ IF EXISTS ] "pub_name"

go


DROP SYNCHRONIZATION PROFILE [ IF EXISTS ] "sync_profile"

go


But these are not working and it's throwing an error -131 (Syntax error)

It works If we remove IF EXISTS clause from the statements. We would like to add IF EXISTS in the query to make sure no error throws eventhough DROP statement executes if publication does not exist in UDB.


Please let me know if we are doing wrong here. Please suggest us the correct way.



Thanks,

Suman Kumar

Accepted Solutions (1)

Accepted Solutions (1)

chris_keating
Advisor
Advisor
0 Kudos

Generally, the SQL file supplied to ALTER DATABASE SCHEMA FROM FILE would represent the schema that you want the remote to use. Is there a reason that the publication and sync profile need to be dropped after that ALTER?

The IF EXISTS was added to the DROP statements in v12. An example statement is:

     DROP PUBLICATION IF EXISTS p;

Former Member
0 Kudos

We figured it out. ALTER would recreate the schema of UDB. But we thought, its modifies existing Schema.

So, here in SQL file, drop publication statement doesn't work as it alters whole publications.

Thanks for the help.

I have one more doubt.

Is there a way to get Publication Names of UDB. At Present, we are maintaining a plist file with Publication names and versions. We would like to avoid plist. So, I am looking for an alternate to fetch Publication names from UDB.

Is there a query that can be executed to fetch Publications info?

Please suggest me..

Thanks,

Suman Kumar

chris_keating
Advisor
Advisor
0 Kudos

You can query the syspublication table.

The script version is defined in the MobiLink system tables on the consolidated database.

Answers (1)

Answers (1)

former_member182948
Active Participant
0 Kudos

Hi Suman,

I might be wrong, but I believe there are a few errors in the statement.

If you were really using the statements such as the example, it would be error.

You shouldn't describe the brackets ("[" and "]") to the statements.

It shows an optional item in the document.

When the actual statement were correct, we will need the product version and build number.

Thanks,

Koichi