I'm just learning SQL Anywhere.Recently I have a Android project which uses MobiLink to synchronize data with Oracle 10g database.The sample CustDB I've read,but I'm not very clear on URLSuffix and SQL Anywhere Relay Server.So I do not know how to connect to the specified MobiLink server in my own application.Who can give me a hand?

asked 05 Aug '11, 00:13

Resare%20Lew's gravatar image

Resare Lew
36126
accept rate: 0%

edited 08 Aug '11, 03:46


Assuming you have code a bit like this:

SyncParms sp = _conn.createSyncParms("ml_username", "script_version");
StreamHTTPParms httpParms = sp.getStreamParms();
httpParms.setHost(host);
httpParms.setURLSuffix(urlSuffix);
_conn.synchronize(sp);

Then for an emulator synchronizing to a MobiLink server on your desktop, you need to use the special host value "10.0.2.2", with no URLSuffix. The port will be 80 by default, so if you are running the ML server on a different port you will need to call httpParms.setPort(NN) as well. I'd recommend getting emulator/local machine running first, as it has the fewest moving parts.

As a second setup, if you have a device that needs to synchronize and which is not on an internal network (so it can't resolve the host name of the machine your MobiLink server is running on) then you can set up an account on our hosted relay server. Here are some old instructions on how to do that.

Then you would call setHost("relayserver.sybase.com") and the setURLSuffix would have an argument like this:

setURLSuffix("/ias_relay_server/client/rs_client.dll/yourname.yourserver");
permanent link

answered 05 Aug '11, 11:49

Tom%20Slee's gravatar image

Tom Slee
1.3k21629
accept rate: 29%

Comment Text Removed
Comment Text Removed
Comment Text Removed

Thanks for your answer.

I thought that we should set the host,port,suffix,username and password in my program to connect to the MobiLink server.Just like JDBC.But in CustDB's code,I did not find that.So I felt very confused about it...

Now I know that we should use the Sybase Relay Server.Then our application can relate to the Sybase Relay Server.But how does the MobiLink server relate to the Sybase Relay Server?

As my Android application will synchronize data with Oracle 10g database,I used ODBC to create the MobiLink server.And the Oracle database was installed on another machine.Both of the machines are in a internal network currently...

(08 Aug '11, 03:14) Resare Lew
Replies hidden

Do you mean that the host should be set as "10.0.2.2"(localhost) and with no URLSuffix if I run emulator/local machine?But how does my application relate to the specified MobiLink server without URLSuffix?

(08 Aug '11, 03:14) Resare Lew
Replies hidden
Comment Text Removed
1

The Relay Server is provided to help connections through firewalls without opening up additional ports to the outside world.

(08 Aug '11, 10:49) Tom Slee
1

"Do you mean that the host should be set as "10.0.2.2"(localhost) and with no URLSuffix if I run emulator/local machine?" Yes. Your application just needs to find the host and port that MobiLink is listening on. The URLSuffix is there in case you need to supply additional parameters. If you go through the Relay Server you need to provide a URL Suffix because you need to tell the Relay Server which MobiLink server you are interested in talking to.

(08 Aug '11, 10:50) Tom Slee
Comment Text Removed

My colleagues who develop WinCE applications can use SQL Anywhere to synchronize data directly.However,android platform does not have API supports about JDBC.So we must do that with UltraLiteJ and the Relay Server,which look like a little complicated.What a pity!

(08 Aug '11, 21:10) Resare Lew

If I use Sybase Hosted Service,there's no need to deploy the Relay Server Components to IIS/Apache,is there?

(08 Aug '11, 23:52) Resare Lew
1

Does your colleague use JDBC on a WinCE device to connect straight to a SQL Anywhere server? That would be a bit different to the sync setup.

I think the other main difference is network access and name resolution, which is not really under our control. If your Android device is on a LAN (through a VPN for example) then it could talk straight to MobiLink without a Relay Server. The JDBC URL is just a machine name, and so the CE device must be on a network that provides name resolution.

(09 Aug '11, 09:03) Tom Slee
1

That is correct. The Hosted Relay service is not intended for production use, though.

(09 Aug '11, 09:03) Tom Slee

Thanks for your help once again!

(09 Aug '11, 21:15) Resare Lew
Comment Text Removed
Comment Text Removed
Comment Text Removed
Comment Text Removed
Comment Text Removed
Comment Text Removed
Comment Text Removed

This is my program fragment in Synchrnize method:

...

SyncParms syncParms=conn.createSyncParms(SyncParms.HTTP_STREAM,"test","ksfd 12.0");

StreamHTTPParms streamParms=syncParms.getStreamParms();

streamParms.setHost("10.0.0.2");

streamParms.setPort(80);

conn.synchronize(syncParms);

SyncResult result=syncParms.getSyncResult();

this.conn.commit();

return result;

...

My MobiLink server has been deployed and startuped as the Sybase DocCommentXchange says.But the MobiLink server's console did not print more new information.In my program,ULjException has been catched,but I saw no exception information.Instead,I saw my program running without responding... What's the matter?I guess that there must be something wrong with my MobiLink server.It does not relate to the client(UltraLiteJ on Android).But I just deployed it as the Sybase DocCommentXchange says.And the documentation does not tell enough about Android and UltraLiteJ...

(11 Aug '11, 06:27) Resare Lew

I thought that the main thread must have blocked(no responding),so I wrote the synchronization fragment in a new Thread Class and implemented Runnable.This time,the main thread did not block.However,the Data synchronization failed again...

(11 Aug '11, 06:27) Resare Lew
More comments hidden
showing 2 of 11 show all flat view
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×371
×79

question asked: 05 Aug '11, 00:13

question was seen: 3,648 times

last updated: 27 Oct '23, 14:10