Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

ALTER DATABASE SCHEMA FROM FILE

4 posts in General Discussion Last posting was on 2009-02-20 14:06:56.0Z
Shao Chan Posted on 2009-02-20 09:32:43.0Z
Reply-To: "Shao Chan" <noreply@noreply.com>
From: "Shao Chan" <noreply@noreply.com>
Newsgroups: ianywhere.public.mbusinessanywhere.general
Subject: ALTER DATABASE SCHEMA FROM FILE
Lines: 85
Organization: Civica
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <499e78bb@forums-1-dub>
Date: 20 Feb 2009 01:32:43 -0800
X-Trace: forums-1-dub 1235122363 10.22.241.152 (20 Feb 2009 01:32:43 -0800)
X-Original-Trace: 20 Feb 2009 01:32:43 -0800, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.mbusinessanywhere.general:1332
Article PK: 9372

SQL 11.0.0.1562

Hi all,

I am trying to get get an Ultralite database schema down to the handheld to
build a database and import the schema via the ALTER DATABASE SCHEMA FROM
FILE command.

I am able to get the database created, but I am unable to get the DDL
loaded.

Am I on the right tracks (code snippet below)?

Cheers,

Shao

var dbMgr;
var conn;

dbMgr = CreateObject("iAnywhere.UltraLite.DatabaseManager.mobileServitor");
if (dbMgr == null) {
alert("Fatal Error: Cannot create database manager object: " +
dbMgr.sqlCode);
} else if (dbMgr.sqlCode < 0) {
alert("Fatal Error: Cannot create database manager object: " +
dbMgr.sqlCode);
}

<!--#INCLUDE virtual="../includes/coll_UTF8BIN.js"-->

var stQuery, stQueryStatement, lSuccess;

try {
conn = dbMgr.openConnection("dbf=" + dbMgr.directory +
"\\mobileServitor.udb;UID=dba;PWD=sql");
if (conn == null) {
}
else {
}
} catch (ex) {

if (dbMgr.sqlCode == dbMgr.SQLError.SQLE_ULTRALITE_DATABASE_NOT_FOUND) {

} else if (dbMgr.sqlCode == dbMgr.SQLError.SQLE_BAD_ENCRYPTION_KEY) {
alert("The Mobile Servitor database cannot be accessed as the supplied
encryption key is not correct. Please contact technical support.\n\nNote
that you will not be able to continue until this issue has been resolved.");
return;
} else {
alert("Fatal error: " + ex.getMessage());
}
}

try {
if (conn == null) {
conn = dbMgr.createDatabase("dbf=" + dbMgr.directory +
"\\mobileServitor.udb;UID=dba;PWD=sql", Collation_UTF8BIN, "");
}
} catch (ex) {
if (ex.getMessage != undefined) {
alert("Create database operation failed: " + ex.getMessage());
return;
} else {
dbLogger.logError("Create database operation failed in database.js: " +
ex);
alert("Create database operation failed: " + ex);
return;
}
}


stQuery = "ALTER DATABASE SCHEMA FROM FILE '"+ dbMgr.directory +
"\\mobileServitor.sql'";
alert(stQuery);
alert(conn == null);

stQueryStatement = conn.prepareStatement(stQuery, null);
alert(stQueryStatement == null);
lSuccess = stQueryStatement.executeStatement();
alert(lSuccess);

}


"Chris Keating [Sybase iAnywhere]" <keating_no Posted on 2009-02-20 13:40:19.0Z
From: "Chris Keating [Sybase iAnywhere]" <keating_no@spam_sybase.com>
User-Agent: Thunderbird 2.0.0.19 (Windows/20081209)
MIME-Version: 1.0
Newsgroups: ianywhere.public.mbusinessanywhere.general
Subject: Re: ALTER DATABASE SCHEMA FROM FILE
References: <499e78bb@forums-1-dub>
In-Reply-To: <499e78bb@forums-1-dub>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <499eb2c3@forums-1-dub>
Date: 20 Feb 2009 05:40:19 -0800
X-Trace: forums-1-dub 1235137219 10.22.241.152 (20 Feb 2009 05:40:19 -0800)
X-Original-Trace: 20 Feb 2009 05:40:19 -0800, vip152.sybase.com
Lines: 90
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.mbusinessanywhere.general:1333
Article PK: 9373

Are there any errors reported? Have you tested this ALTER off the device
i.e., via dbisql, to verify that it works? Is the character set of the
script file the same as the database being upgraded?

Shao Chan wrote:
> SQL 11.0.0.1562
>
> Hi all,
>
> I am trying to get get an Ultralite database schema down to the handheld to
> build a database and import the schema via the ALTER DATABASE SCHEMA FROM
> FILE command.
>
> I am able to get the database created, but I am unable to get the DDL
> loaded.
>
> Am I on the right tracks (code snippet below)?
>
> Cheers,
>
> Shao
>
> var dbMgr;
> var conn;
>
> dbMgr = CreateObject("iAnywhere.UltraLite.DatabaseManager.mobileServitor");
> if (dbMgr == null) {
> alert("Fatal Error: Cannot create database manager object: " +
> dbMgr.sqlCode);
> } else if (dbMgr.sqlCode < 0) {
> alert("Fatal Error: Cannot create database manager object: " +
> dbMgr.sqlCode);
> }
>
> <!--#INCLUDE virtual="../includes/coll_UTF8BIN.js"-->
>
> var stQuery, stQueryStatement, lSuccess;
>
> try {
> conn = dbMgr.openConnection("dbf=" + dbMgr.directory +
> "\\mobileServitor.udb;UID=dba;PWD=sql");
> if (conn == null) {
> }
> else {
> }
> } catch (ex) {
>
> if (dbMgr.sqlCode == dbMgr.SQLError.SQLE_ULTRALITE_DATABASE_NOT_FOUND) {
>
> } else if (dbMgr.sqlCode == dbMgr.SQLError.SQLE_BAD_ENCRYPTION_KEY) {
> alert("The Mobile Servitor database cannot be accessed as the supplied
> encryption key is not correct. Please contact technical support.\n\nNote
> that you will not be able to continue until this issue has been resolved.");
> return;
> } else {
> alert("Fatal error: " + ex.getMessage());
> }
> }
>
> try {
> if (conn == null) {
> conn = dbMgr.createDatabase("dbf=" + dbMgr.directory +
> "\\mobileServitor.udb;UID=dba;PWD=sql", Collation_UTF8BIN, "");
> }
> } catch (ex) {
> if (ex.getMessage != undefined) {
> alert("Create database operation failed: " + ex.getMessage());
> return;
> } else {
> dbLogger.logError("Create database operation failed in database.js: " +
> ex);
> alert("Create database operation failed: " + ex);
> return;
> }
> }
>
>
> stQuery = "ALTER DATABASE SCHEMA FROM FILE '"+ dbMgr.directory +
> "\\mobileServitor.sql'";
> alert(stQuery);
> alert(conn == null);
>
> stQueryStatement = conn.prepareStatement(stQuery, null);
> alert(stQueryStatement == null);
> lSuccess = stQueryStatement.executeStatement();
> alert(lSuccess);
>
> }
>
>


Shao Chan Posted on 2009-02-20 14:06:56.0Z
Reply-To: "Shao Chan" <noreply@noreply.com>
From: "Shao Chan" <noreply@noreply.com>
Newsgroups: ianywhere.public.mbusinessanywhere.general
References: <499e78bb@forums-1-dub> <499eb2c3@forums-1-dub>
Subject: Re: ALTER DATABASE SCHEMA FROM FILE
Lines: 113
Organization: Civica
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <499eb900@forums-1-dub>
Date: 20 Feb 2009 06:06:56 -0800
X-Trace: forums-1-dub 1235138816 10.22.241.152 (20 Feb 2009 06:06:56 -0800)
X-Original-Trace: 20 Feb 2009 06:06:56 -0800, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.mbusinessanywhere.general:1335
Article PK: 9374

Hi Chris,

Thanks for that.

dbisql works just fine. I've done ulcreates and loaded the schema up just
fine for the last few weeks. Other than a bug with ulunload which didn't
put some commas in it worked fine.

However, I found that if using the ALTER DATABASE SCHEMA FROM FILE command,
it doesn't like the comments generated by uunload. I have raised a
technical support call. This problem persists both if I do it on the server
via Sybase Central Ultralite dbisql or from createDatabase within the M-Biz
followed by getting a connection and executing the ALTER DATABASE SCHEMA
FROM FILE command.

Cheers,

Shao

"Chris Keating [Sybase iAnywhere]" <keating_no@spam_sybase.com> wrote in
message news:499eb2c3@forums-1-dub...
> Are there any errors reported? Have you tested this ALTER off the device
> i.e., via dbisql, to verify that it works? Is the character set of the
> script file the same as the database being upgraded?
>
> Shao Chan wrote:
>> SQL 11.0.0.1562
>>
>> Hi all,
>>
>> I am trying to get get an Ultralite database schema down to the handheld
>> to build a database and import the schema via the ALTER DATABASE SCHEMA
>> FROM FILE command.
>>
>> I am able to get the database created, but I am unable to get the DDL
>> loaded.
>>
>> Am I on the right tracks (code snippet below)?
>>
>> Cheers,
>>
>> Shao
>>
>> var dbMgr;
>> var conn;
>>
>> dbMgr =
>> CreateObject("iAnywhere.UltraLite.DatabaseManager.mobileServitor");
>> if (dbMgr == null) {
>> alert("Fatal Error: Cannot create database manager object: " +
>> dbMgr.sqlCode);
>> } else if (dbMgr.sqlCode < 0) {
>> alert("Fatal Error: Cannot create database manager object: " +
>> dbMgr.sqlCode);
>> }
>>
>> <!--#INCLUDE virtual="../includes/coll_UTF8BIN.js"-->
>>
>> var stQuery, stQueryStatement, lSuccess;
>>
>> try {
>> conn = dbMgr.openConnection("dbf=" + dbMgr.directory +
>> "\\mobileServitor.udb;UID=dba;PWD=sql");
>> if (conn == null) {
>> }
>> else {
>> }
>> } catch (ex) {
>>
>> if (dbMgr.sqlCode == dbMgr.SQLError.SQLE_ULTRALITE_DATABASE_NOT_FOUND) {
>>
>> } else if (dbMgr.sqlCode == dbMgr.SQLError.SQLE_BAD_ENCRYPTION_KEY) {
>> alert("The Mobile Servitor database cannot be accessed as the supplied
>> encryption key is not correct. Please contact technical support.\n\nNote
>> that you will not be able to continue until this issue has been
>> resolved.");
>> return;
>> } else {
>> alert("Fatal error: " + ex.getMessage());
>> }
>> }
>>
>> try {
>> if (conn == null) {
>> conn = dbMgr.createDatabase("dbf=" + dbMgr.directory +
>> "\\mobileServitor.udb;UID=dba;PWD=sql", Collation_UTF8BIN, "");
>> }
>> } catch (ex) {
>> if (ex.getMessage != undefined) {
>> alert("Create database operation failed: " + ex.getMessage());
>> return;
>> } else {
>> dbLogger.logError("Create database operation failed in database.js: "
>> + ex);
>> alert("Create database operation failed: " + ex);
>> return;
>> }
>> }
>>
>>
>> stQuery = "ALTER DATABASE SCHEMA FROM FILE '"+ dbMgr.directory +
>> "\\mobileServitor.sql'";
>> alert(stQuery);
>> alert(conn == null);
>>
>> stQueryStatement = conn.prepareStatement(stQuery, null);
>> alert(stQueryStatement == null);
>> lSuccess = stQueryStatement.executeStatement();
>> alert(lSuccess);
>>
>> }


Shao Chan Posted on 2009-02-20 14:03:08.0Z
Reply-To: "Shao Chan" <noreply@noreply.com>
From: "Shao Chan" <noreply@noreply.com>
Newsgroups: ianywhere.public.mbusinessanywhere.general
References: <499e78bb@forums-1-dub>
Subject: Re: ALTER DATABASE SCHEMA FROM FILE
Lines: 100
Organization: Civica
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <499eb81c@forums-1-dub>
Date: 20 Feb 2009 06:03:08 -0800
X-Trace: forums-1-dub 1235138588 10.22.241.152 (20 Feb 2009 06:03:08 -0800)
X-Original-Trace: 20 Feb 2009 06:03:08 -0800, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.mbusinessanywhere.general:1334
Article PK: 17952

Hi all,

Finally got it working and figured out what was wrong - a couple of changes
and a bug where the ALTER DATABASE SCHEMA FROM FILE command doesn't like
comments.

Cheers,

Shao

"Shao Chan" <noreply@noreply.com> wrote in message
news:499e78bb@forums-1-dub...
> SQL 11.0.0.1562
>
> Hi all,
>
> I am trying to get get an Ultralite database schema down to the handheld
> to build a database and import the schema via the ALTER DATABASE SCHEMA
> FROM FILE command.
>
> I am able to get the database created, but I am unable to get the DDL
> loaded.
>
> Am I on the right tracks (code snippet below)?
>
> Cheers,
>
> Shao
>
> var dbMgr;
> var conn;
>
> dbMgr =
> CreateObject("iAnywhere.UltraLite.DatabaseManager.mobileServitor");
> if (dbMgr == null) {
> alert("Fatal Error: Cannot create database manager object: " +
> dbMgr.sqlCode);
> } else if (dbMgr.sqlCode < 0) {
> alert("Fatal Error: Cannot create database manager object: " +
> dbMgr.sqlCode);
> }
>
> <!--#INCLUDE virtual="../includes/coll_UTF8BIN.js"-->
>
> var stQuery, stQueryStatement, lSuccess;
>
> try {
> conn = dbMgr.openConnection("dbf=" + dbMgr.directory +
> "\\mobileServitor.udb;UID=dba;PWD=sql");
> if (conn == null) {
> }
> else {
> }
> } catch (ex) {
>
> if (dbMgr.sqlCode == dbMgr.SQLError.SQLE_ULTRALITE_DATABASE_NOT_FOUND) {
>
> } else if (dbMgr.sqlCode == dbMgr.SQLError.SQLE_BAD_ENCRYPTION_KEY) {
> alert("The Mobile Servitor database cannot be accessed as the supplied
> encryption key is not correct. Please contact technical support.\n\nNote
> that you will not be able to continue until this issue has been
> resolved.");
> return;
> } else {
> alert("Fatal error: " + ex.getMessage());
> }
> }
>
> try {
> if (conn == null) {
> conn = dbMgr.createDatabase("dbf=" + dbMgr.directory +
> "\\mobileServitor.udb;UID=dba;PWD=sql", Collation_UTF8BIN, "");
> }
> } catch (ex) {
> if (ex.getMessage != undefined) {
> alert("Create database operation failed: " + ex.getMessage());
> return;
> } else {
> dbLogger.logError("Create database operation failed in database.js: " +
> ex);
> alert("Create database operation failed: " + ex);
> return;
> }
> }
>
>
> stQuery = "ALTER DATABASE SCHEMA FROM FILE '"+ dbMgr.directory +
> "\\mobileServitor.sql'";
> alert(stQuery);
> alert(conn == null);
>
> stQueryStatement = conn.prepareStatement(stQuery, null);
> alert(stQueryStatement == null);
> lSuccess = stQueryStatement.executeStatement();
> alert(lSuccess);
>
> }
>