ERROR:::

com.example.administrator.a111 E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering

/com.example.administrator.a111 E/dalvikvm: Could not find class 'org.ietf.jgss.GSSManager', referenced from method com.sybase.jdbc3.jdbc.SybProperty.setConnProperty /com.example.administrator.a111 E/dalvikvm: Could not find class 'org.ietf.jgss.GSSManager', referenced from method com.sybase.jdbc3.jdbc.SybProperty.verifyProps /com.example.administrator.a111 E/dalvikvm: Could not find class 'com.sybase.jdbc3.jdbc.SybCallableStatementCopy', referenced from method com.sybase.jdbc3.jdbc.SybConnection.copyCallableStatement /com.example.administrator.a111 E/dalvikvm: Could not find class 'com.sybase.jdbc3.jdbc.SybPreparedStatementCopy', referenced from method com.sybase.jdbc3.jdbc.SybConnection.copyPreparedStatement

/com.example.administrator.a111 E/dalvikvm: Could not find class 'com.sybase.jdbc3.jdbc.SybStatement', referenced from method com.sybase.jdbc3.jdbc.SybConnection.createStatement

/com.example.administrator.a111 E/dalvikvm: Could not find class 'com.sybase.jdbc3.jdbc.SybStatement', referenced from method com.sybase.jdbc3.jdbc.SybConnection.createStatement

/com.example.administrator.a111 E/dalvikvm: Could not find class 'com.sybase.jdbc3.jdbc.SybStatement', referenced from method com.sybase.jdbc3.jdbc.SybConnection.nativeSQL

/com.example.administrator.a111 E/dalvikvm: Could not find class 'com.sybase.jdbc3.jdbc.SybCallableStatement', referenced from method com.sybase.jdbc3.jdbc.SybConnection.prepareCall

/com.example.administrator.a111 E/dalvikvm: Could not find class 'com.sybase.jdbc3.jdbc.SybCallableStatement', referenced from method com.sybase.jdbc3.jdbc.SybConnection.prepareCall

/com.example.administrator.a111 E/dalvikvm: Could not find class 'com.sybase.jdbc3.jdbc.SybPreparedStatement', referenced from method com.sybase.jdbc3.jdbc.SybConnection.prepareStatement

/com.example.administrator.a111 E/dalvikvm: Could not find class 'com.sybase.jdbc3.jdbc.SybPreparedStatement', referenced from method com.sybase.jdbc3.jdbc.SybConnection.prepareStatement

/com.example.administrator.a111 E/dalvikvm: Could not find class 'com.sybase.jdbc3.jdbc.SybPreparedStatement', referenced from method com.sybase.jdbc3.jdbc.SybConnection.prepareStatement

W/System.err: android.os.NetworkOnMainThreadException /com.example.administrator.a111 W/System.err: at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1145) /com.example.administrator.a111 W/System.err: at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:84) /com.example.administrator.a111 W/System.err: at libcore.io.IoBridge.connectErrno(IoBridge.java:127) /com.example.administrator.a111 W/System.err: at libcore.io.IoBridge.connect(IoBridge.java:112) /com.example.administrator.a111 W/System.err: at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192) /com.example.administrator.a111 W/System.err: at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) /com.example.administrator.a111 W/System.err: at java.net.Socket.startupSocket(Socket.java:567) /com.example.administrator.a111 W/System.err: at java.net.Socket.tryAllAddresses(Socket.java:128) /com.example.administrator.a111 W/System.err: at java.net.Socket.<init>(Socket.java:178) /com.example.administrator.a111 W/System.err: at java.net.Socket.<init>(Socket.java:150) /com.example.administrator.a111 W/System.err: at com.sybase.jdbc3.timedio.RawDbio.doConnect(Unknown Source) /com.example.administrator.a111 W/System.err: at com.sybase.jdbc3.timedio.InStreamMgr.<init>(Unknown Source) /com.example.administrator.a111 W/System.err: at com.sybase.jdbc3.tds.Tds.login(Unknown Source) /com.example.administrator.a111 W/System.err: at com.sybase.jdbc3.jdbc.SybConnection.a(Unknown Source) /com.example.administrator.a111 W/System.err: at com.sybase.jdbc3.jdbc.SybConnection.a(Unknown Source) /com.example.administrator.a111 W/System.err: at com.sybase.jdbc3.jdbc.SybConnection.<init>(Unknown Source) /com.example.administrator.a111 W/System.err: at com.sybase.jdbc3.jdbc.SybConnection.<init>(Unknown Source) /com.example.administrator.a111 W/System.err: at com.sybase.jdbc3.jdbc.SybDriver.connect(Unknown Source) /com.example.administrator.a111 W/System.err: at java.sql.DriverManager.getConnection(DriverManager.java:179) /com.example.administrator.a111 W/System.err: at java.sql.DriverManager.getConnection(DriverManager.java:213) /com.example.administrator.a111 W/System.err: at com.example.administrator.a111.MainActivity.onCreate(MainActivity.java:29) /com.example.administrator.a111 W/System.err: at android.app.Activity.performCreate(Activity.java:5231) /com.example.administrator.a111 W/System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) /com.example.administrator.a111 W/System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159) /com.example.administrator.a111 W/System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) /com.example.administrator.a111 W/System.err: at android.app.ActivityThread.access$800(ActivityThread.java:135) /com.example.administrator.a111 W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) /com.example.administrator.a111 W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102) /com.example.administrator.a111 W/System.err: at android.os.Looper.loop(Looper.java:136) /com.example.administrator.a111 W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5017) /com.example.administrator.a111 W/System.err: at java.lang.reflect.Method.invokeNative(Native Method) /com.example.administrator.a111 W/System.err: at java.lang.reflect.Method.invoke(Method.java:515) /com.example.administrator.a111 W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) /com.example.administrator.a111 W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) /com.example.administrator.a111 W/System.err: at dalvik.system.NativeStart.main(Native Method)


java code:

package com.example.administrator.a111; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; import android.database.SQLException; import android.widget.TextView; public class MainActivity extends AppCompatActivity { private TextView mytext; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mytext = (TextView)this.findViewById(R.id.mytext); Connection con = null; try{ Class.forName("com.sybase.jdbc3.jdbc.SybDriver").newInstance(); System.out.println("ok"); con = DriverManager.getConnection("jdbc:sybase:Tds:100.168.1.237:2638/mm", "dba", "SQL"); if (con != null) { // System.out.println(con); android.util.Log.i("zas","con is open:"+con.isClosed()); testConnection(con);//test } }catch (Exception e){ // System.out.println(e); e.printStackTrace(); } /*try { testConnection(con);//test } catch (java.sql.SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); }*/ } public void testConnection(Connection con) throws java.sql.SQLException { try { String sql = "SELECT * FROM table_test";// “table_test” Statement stmt = con.createStatement();// Statement ResultSet rs = stmt.executeQuery(sql);//ResultSet Cursor String s = "result:\n"; while (rs.next()) {//ResultSet s += rs.getString("user_name")+"\n";// } this.mytext.setText(s); rs.close(); stmt.close(); } catch (SQLException e) { e.printStackTrace(); // System.out.println(toString()); } finally { if (con != null) try { con.close(); } catch (SQLException e) { } } } }

asked 08 Jan, 06:01

mfkpie8's gravatar image

mfkpie8
80444853
accept rate: 9%

edited 08 Jan, 06:17

1

I don't know the answer, but I doubt that it is a good idea to connect to a real DB over the network using JDBC - please read why: http://stackoverflow.com/a/7221716 .

What you can try to do is to use the latest version of jConnect (not the 3rd version, but 4th), but again, I do not like the way you chose.

The solution is already described on SO, but I will repeat it - use the web service (SA can create OData services for you), or MobiLink to replicate required records to your device.

(08 Jan, 08:46) Vlad
Replies hidden
Comment Text Removed

Hi Vlad, your stackoverflow link brought me to "page not found". Cheers, Volker

(09 Jan, 09:00) Volker DB-TecKy

It is because, the 'dot' was captured by the markup processor. Here is the correct link:

http://stackoverflow.com/a/7221716

(09 Jan, 09:02) Vlad

jConnect is not supported on Android (or other mobile JVMs). It is designed for J2SE and most mobile JVMs are not compatible with J2SE.

Options are to use MobiLink to synchronize data to an UltraLite database as a remote database or use OData to serve data to Android.

permanent link

answered 09 Jan, 22:15

Chris%20Keating's gravatar image

Chris Keating
3.2k1956
accept rate: 29%

as i remenber only versions 12 and 15 have mobilink and ultralite.. still using java , windoze M$ users have now a pain .. maybe u must use ODBC over androit , due androit its basically linux, compile and make it aand apk with freedts included

in this way u apport to the freedts opensource, and let it go the stupid java tecnology, use gambas maybe or qt

permanent link

answered 11 Jan, 07:57

mckaygerhard's gravatar image

mckaygerhard
13127
accept rate: 12%

edited 11 Jan, 07:59

While I can't comment on the rest of your recommendations, there is no SQL Anywhere version 15, and certainly v16 and above do contain the MobiLink and Ultralite components...

(11 Jan, 09:31) Volker Barth

i installed the anywhwre just for check, and mobilink plugin connection does not appears! only appears for sql anywhere 12.0.1 maybe u have a paid version?

(11 Jan, 10:59) mckaygerhard

You are probably trolling the community, if you do not understand the difference between Dalvik, ART and HotSpot, this forum is not a right place to argue why another "stupid java tecnology" doesn't work on "androit - basically linux". My life is to short to feed you. Sorry.

(11 Jan, 12:13) Vlad
Replies hidden

@Vlad stop calling me troll, i used sql anywhere and dont see the Qmobilink plugin connector, i only see in the 15 and 12, i have all the version since conmverted to java based gui and sybase separates from M$ so i already know whats i taking about! thins like "LIMIT" many users said "that not true" but the real its that they're ignores how to made it!

Image that show not have Qmobilink plugin since anywhere 16

(12 Jan, 13:51) mckaygerhard

FWIW, here's my v17 SQL Central plugin overview.

It's from a paid version, and I have not installed all components, but the dev edition should include that, as well, so MobiLink and UltraLite definetely are supported with v17:

alt text

(13 Jan, 02:33) Volker Barth

i'm afraid that the developed version dont include that u point, i download the development editio0n and i not have it

in any case, some weeks ago i read in documentation that sybase since 16 comes separately their components...

well in any case, about the androit problem, the best solution its ODBC (well JDBC i dont know if work), currently i'm comtribute in freedts around nvarchar and nchar support and the connection protocol for sybase must be 5

(13 Jan, 08:52) mckaygerhard

These components are plugins and can be loaded and/or registered from the Tools| Plugins menu. If the plugin is not loaded, you can manually Load it. If it is not listed, it has not been registered. Click Register, select the registration file option, and go to the %SQLANY17%\java directory. There will be 3 options (MobiLink, SQLAnywhere, and UltraLite) assuming that you installed the associated component.

(16 Jan, 09:20) Chris Keating

i research and i not have any plugin, only those, in lib directory only have the share libs .so files, no jars, and in bin32 (i used 32bit flavor) obviously only have the binaryes to lauch..

(16 Jan, 09:55) mckaygerhard
More comments hidden
showing 5 of 8 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:

×78

question asked: 08 Jan, 06:01

question was seen: 907 times

last updated: 16 Jan, 09:55