on 2011 Aug 22 12:35 PM
SyncParms sp = _conn.createSyncParms(SyncParms.HTTPS_STREAM, "ml_username", "script_version"); StreamHTTPSParms streamParms = (StreamHTTPSParms) syncParms.getStreamParms(); streamParms.setHost( host ); streamParms.setPort( port ); _conn.synchronize(sp);
I have started my MobiLink server correctly:
<Main> https.2500: RSA_TLS: This secure stream is being encrypted using security technology from Certicom Corp. <Main> This software is using security technology from Certicom Corp. <Main> MobiLink server started
If I try to connect to the ML server through my android app I get Error code 224. (I have no problems connecting through HTTP)
Request clarification before answering.
The next thing to verify is that the 2nd parameter to DatabaseManager.createConfigurationFileAndroid() is a valid Context object. Eg.
ConfigFileAndroid config = DatabaseManager.createConfigurationFileAndroid( "test.udb", getApplicationContext());
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When executing DatabaseManager.createConfigurationFileAndroid the second parameter has the value: android.app.Application@44ef4458 (I can see this in debug mode). Also, when executing the same code but trying to connect to an HTTP server i have no problems, so I asume it is a valid context object. Any other suggestions?
I modified our custdb sample to use HTTPS data sync (pasting in some of the code you provided), but still could not reproduce the problem.
It occurs to me that it could be the MobiLink server that could not find a library. Where do you see the error message with code 224? In the ML server log? A ULjException in the client application? Also, please give us the exact text of the error message.
The below is the ULjException that I get in the custdb application if I manually remove libmlcrsa12.so from the emulator:
08-24 10:50:08.448: ERROR/CustDB(273): com.ianywhere.ultralitejni12.implementation.JniException: UltraLiteJ Error[-1305]: MobiLink communication error -- code: 224, parameter: libmlcrsa12.so, system code: 0
I am almost out of ideas. You could check that the libmlcrsa12.so that is in the emulator is byte-for-byte the same as the one in the SQL Anywhere install.
If that is the case, the only other thing is that something in your application is different from the applications we use to test with. Could you package up a complete Eclipse project that shows the problem? (eg. using the ML server command line for our custdb sample, with the sample rasroot.crt in the install) If we can reproduce the problem, then we can fix it. Thanks.
PS You can email me the sample Eclipse project at firstname.lastname [at] sybase.com
Andy Quick Sybase, an SAP company
Sebastian - We cannot reproduce this issue here: our samples using HTTPS do work. You could test your environment by trying the CustDB sample included with SQL Anywhere and changing StreamHTTPParms to StreamHTTPSParms, to see if that project works for you. Otherwise, emailing the project as suggested or opening a tech support case look like the ways forward.
Error code 224 is "Failed to load library" (see here).
It looks like you need to include the library libmlcrsa12.so in the same folder as the UltraLite library (the libsarmeabi subdirectory of your project). You can find libmlcrsa12.so in the UltraLite\\UltraLiteJ\\Android\\ARM subdirectory of your SQL Anywhere application.
If you have any issues with certificates for HTTPS, you may find something in a recent blog post on the subject: see here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In my project, I have the library libmlcrsa12.so in my libs/armeabi folder. When I deploy my project to the emulator I found the libmlcrsa12.so and libultralitej12.so under data/data/<my-project-package>/lib/
I've also created my HTTPS certificates and started my MobiLink server correctly, but still can't connect through my app.
Thanks for your help.
Here is my code:
Connection _conn; ConfigPersistent _config; public void onCreate(Bundle savedInstanceState) { try{ super.onCreate(savedInstanceState); InputStream is = getResources().openRawResource(R.raw.cert); FileOutputStream os = openFileOutput("cert.pem", MODE_PRIVATE); byte[] buff = new byte[4096]; int n; for(;;) { n = is.read(buff); if (n < 0) break; os.write(buff, 0, n); } _config = DatabaseManager.createConfigurationFileAndroid("DATABASE_NAME", getApplicationContext()); _config.setLazyLoadIndexes(true); _conn = DatabaseManager.connect(_config); _conn = DatabaseManager.connect(_config); SyncParms syncParms = _conn.createSyncParms(SyncParms.HTTPS_STREAM,_user,_version ); syncParms.setPassword("passwordd"); StreamHTTPSParms streamParms = (StreamHTTPSParms) syncParms.getStreamParms(); streamParms.setHost( _host ); streamParms.setPort( _port ); streamParms.setTrustedCertificates("/data/data/<package>/files/cert.pem"); _conn.synchronize( syncParms ); } catch (Exception e) { e.printStackTrace(); } }
I am using an Android 2.2 emulator.
Thanks for your help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
One thing I notice in this code fragment is that the ConfigFileAndroid object that is returned by DatabaseManager.createConfigurationFileAndroid() is not stored in a variable. You must actually pass this object as an argument to DatabaseManager.createDatabase() or connect(). Using a ConfigPersistent object that was created without going through createConfigurationFileAndroid() would cause a problem like this.
User | Count |
---|---|
87 | |
10 | |
9 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.