Home > Archive > SQL Anywhere database > December 2005 > on Pocket PC hide database server screen when eng name is long









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author on Pocket PC hide database server screen when eng name is long
Nels

2005-12-23, 1:23 pm

(I submitted the following a few minutes ago but don't see
it in the list of newsgroup posts in
sybase.public.sqlanywhere.general. I sent a shorter message
after the original post, and the shorter post showed up, so
I decided to re-submit the following, in case the first time
didn't work.)

In my Compact Framework 1.0 application, when a user logs
in, if the ASA database engine isn't running, then it starts
up the engine. Otherwise it connects to the already running
db engine. We are using the Pocket PC's unique device ID
for the ASA database engine name running on the PPC, so that
there are no potential conflicts when two or more PPC's are
connected to the network (in order to be able to connect to
the PPC db's from sybase central across the network). A PPC
device's unique ID is 33 characters long. An example is
258G03J382768JSD8283
-0283J8238582. If I run something like
the following:



Dim acon As AsaConnection

acon = new AsaConnection("dbf=\program
files\myapp\thedb. db;uid=uid;pwd=pwd;a
utostop=no;start=\pr
ogram
files\sybase\asa9\db
srv9.exe -qi -qp -qs -qw -x tcpip -ti
240 -n 12345678901234567890
1234")

acon.open()



then this works. However if I add one more character/digit
to the -n option, then the call to acon.open() results in
the following AsaException:

{iAnywhere.Data.AsaClient.AsaException}

Errors: {iAnywhere.Data.AsaClient.AsaErrorCollection}

InnerException: Nothing

Message: "Database server not found"

NativeError: -100

Source: "ASA .NET Data Provider"



So there seems to be a 24-character limitation for the
engine name. However I discovered that the database engine
is actually started on the PPC, even though the exception
occurred. The same holds true if I use a 33-character
engine name (device ID) such as the following:
258G03J382768JSD8283
-0283J8238582.



I configured the VB code something like the following in
order to support 1) the 33-character engine name, 2)
starting db engine if not already started, 3) connecting to
db engine:



sCon = New AsaConnection("start=\program
files\sybase\asa9\db
srv9.exe -qi -qp -qs -qw -x tcpip -ti
240 -n 258G03J382768JSD8283
-0283J8238582 ""\program
files\myapp\thedb.db"" -n
thedb;autostop=no;ui
d=uid;pwd=pwd;")

Try

sCon.Open()

Catch ex As Exception

sCon = Nothing

sCon = New
AsaConnection(" eng=258G03J382768JSD
8283- 0283J8238582;dbn=the
db;
Uid=uid;pwd=pwd;comm
links=tcpip{host=127.0.0.1}")

sCon.Open()

End Try



So before the exception occurs, the database engine is
started (if it isn't already started). After the exception
is thrown ("Database server not found"), then a new
AsaConnection is set up to connect to the running db and a
connection is established by calling scon.open(), which
doesn't lead to an exception.



This works fine, except for the following: When the
exception occurs, it seems to cause the database server
screen to appear above my application screen, even though I
used the dbsrv9 startup options "-qi -qp -qs -qw". If I
shorten the engine name, then the exception doesn't occur
and the database server screen doesn't appear.



I am using iAnywhere.Data.AsaClient, path="C:\Program
Files\Microsoft Visual Studio .NET
2003\CompactFramewor
kSDK\v1.0.5000\Windows
CE\iAnywhere.Data.AsaClient.dll", version=9.0.2.3137.



Is there a way to get this to work so that the database
server screen doesn't appear?



Here are some possibilities:

1. Maybe a newer ebf fixes the issue where the exception
"Database server not found" occurs when you call
asaconnection.open() with a "start" option and and "eng"
option that is longer than 24 characters.

2. Maybe there is another dbsrv9 parameter that I missed
that will prevent the database server screen from appearing
when an exception occurs.

3. Perhaps there is a different arrangement of parameters in
the connection string for AsaConnection that will allow for
a 33-character engine name.



Thanks.

Nels
Raymond Kwong

2005-12-24, 3:23 am

This could very well be a limitation on the length of a connection
string.

I'll suggest getting rid of all those qi -qp -qs -qw -ti 240 switches
and test with the full unique id.

Or put the above switches in a file (eg. \params.txt)

and use @params.txt to replace all these switches above.

Raymond Kwong
iAnywhere Solutions

On 23 Dec 2005 10:43:01 -0800, Nels wrote:

>(I submitted the following a few minutes ago but don't see
>it in the list of newsgroup posts in
>sybase.public.sqlanywhere.general. I sent a shorter message
>after the original post, and the shorter post showed up, so
>I decided to re-submit the following, in case the first time
>didn't work.)
>
>In my Compact Framework 1.0 application, when a user logs
>in, if the ASA database engine isn't running, then it starts
>up the engine. Otherwise it connects to the already running
>db engine. We are using the Pocket PC's unique device ID
>for the ASA database engine name running on the PPC, so that
>there are no potential conflicts when two or more PPC's are
>connected to the network (in order to be able to connect to
>the PPC db's from sybase central across the network). A PPC
>device's unique ID is 33 characters long. An example is
> 258G03J382768JSD8283
-0283J8238582. If I run something like
>the following:
>
>
>
>Dim acon As AsaConnection
>
>acon = new AsaConnection("dbf=\program
>files\myapp\thedb. db;uid=uid;pwd=pwd;a
utostop=no;start=\pr
ogram
> files\sybase\asa9\db
srv9.exe -qi -qp -qs -qw -x tcpip -ti
>240 -n 12345678901234567890
1234")
>
>acon.open()
>
>
>
>then this works. However if I add one more character/digit
>to the -n option, then the call to acon.open() results in
>the following AsaException:
>
>{iAnywhere.Data.AsaClient.AsaException}
>
> Errors: {iAnywhere.Data.AsaClient.AsaErrorCollection}
>
> InnerException: Nothing
>
> Message: "Database server not found"
>
> NativeError: -100
>
> Source: "ASA .NET Data Provider"
>
>
>
>So there seems to be a 24-character limitation for the
>engine name. However I discovered that the database engine
>is actually started on the PPC, even though the exception
>occurred. The same holds true if I use a 33-character
>engine name (device ID) such as the following:
> 258G03J382768JSD8283
-0283J8238582.
>
>
>
>I configured the VB code something like the following in
>order to support 1) the 33-character engine name, 2)
>starting db engine if not already started, 3) connecting to
>db engine:
>
>
>
>sCon = New AsaConnection("start=\program
> files\sybase\asa9\db
srv9.exe -qi -qp -qs -qw -x tcpip -ti
>240 -n 258G03J382768JSD8283
-0283J8238582 ""\program
>files\myapp\thedb.db"" -n
> thedb;autostop=no;ui
d=uid;pwd=pwd;")
>
>Try
>
> sCon.Open()
>
>Catch ex As Exception
>
> sCon = Nothing
>
> sCon = New
>AsaConnection(" eng=258G03J382768JSD
8283- 0283J8238582;dbn=the
db;
> Uid=uid;pwd=pwd;comm
links=tcpip{host=127.0.0.1}")
>
> sCon.Open()
>
>End Try
>
>
>
>So before the exception occurs, the database engine is
>started (if it isn't already started). After the exception
>is thrown ("Database server not found"), then a new
>AsaConnection is set up to connect to the running db and a
>connection is established by calling scon.open(), which
>doesn't lead to an exception.
>
>
>
>This works fine, except for the following: When the
>exception occurs, it seems to cause the database server
>screen to appear above my application screen, even though I
>used the dbsrv9 startup options "-qi -qp -qs -qw". If I
>shorten the engine name, then the exception doesn't occur
>and the database server screen doesn't appear.
>
>
>
>I am using iAnywhere.Data.AsaClient, path="C:\Program
>Files\Microsoft Visual Studio .NET
> 2003\CompactFramewor
kSDK\v1.0.5000\Windows
>CE\iAnywhere.Data.AsaClient.dll", version=9.0.2.3137.
>
>
>
>Is there a way to get this to work so that the database
>server screen doesn't appear?
>
>
>
>Here are some possibilities:
>
>1. Maybe a newer ebf fixes the issue where the exception
>"Database server not found" occurs when you call
>asaconnection.open() with a "start" option and and "eng"
>option that is longer than 24 characters.
>
>2. Maybe there is another dbsrv9 parameter that I missed
>that will prevent the database server screen from appearing
>when an exception occurs.
>
>3. Perhaps there is a different arrangement of parameters in
>the connection string for AsaConnection that will allow for
>a 33-character engine name.
>
>
>
>Thanks.
>
>Nels


Raymond Kwong

2005-12-24, 3:23 am

I take back that
@params.txt comment. It's not supported on CE. Still getting rid of
those -qi -qp -qs etc. switches is going to be useful isolating the
problem

Raymond Kwong
iAnywhere Solutions

On 23 Dec 2005 19:23:40 -0800, Raymond Kwong
<raymond. kwong_RAY158324@syba
se.com> wrote:
[color=darkred]
>This could very well be a limitation on the length of a connection
>string.
>
>I'll suggest getting rid of all those qi -qp -qs -qw -ti 240 switches
>and test with the full unique id.
>
>Or put the above switches in a file (eg. \params.txt)
>
>and use @params.txt to replace all these switches above.
>
>Raymond Kwong
>iAnywhere Solutions
>
>On 23 Dec 2005 10:43:01 -0800, Nels wrote:
>

Nels Cobbey

2005-12-28, 11:23 am

Raymond,

I tried the following, but still got the "Database server not found"
exception:
1. Removed "-qi -qp -qs -qw -x tcpip -ti 240".
2. Removed "-qi -qp -qs -qw -ti 240" but kept "-x tcpip".
3. Removed "-qi -qp -qs -qw -ti 240" and "autostop=no".
4. Removed all of that plus the 2nd "-n" parameter (the database name, not
database engine name).
5. Same as #4 but limited the database engine name to 24 characters long.
This worked -- no exception occurred. After adding one more character, then
got the same exception. So it appears to be a 24-character limit on the
engine name parameter, not the connection string as a whole. Even when the
exception occurs (when the specified engine name is longer than 24
characters) the database engine starts up with the specified engine name.
So the exception doesn't mean that it couldn't set the engine name to the
specified string. It apparently means that it can't connect to it once the
engine is started. Using the try/catch I am able to connect to the database
engine with a second call to asaconnection.open(). However before making
this second call, the exception that occurs seems to cause the database
server screen to appear, which is what I'm trying to avoid. (If I limit the
engine name to 24 characters and include all of the -q... parameters, etc.,
then the database server screen doesn't appear at all.)

Nels


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com