B4A Library MSSQL with JDBC Library v1.00

Hello everyone,

This is my first library.

There are only three functions.

B4X:
   Dim db As MSSQL
        Dim L As List

        db = setDatabase("Server IPNUMBER (not name)","databasename","username","password")

        Try
             'select query
                  L = db.Query("select * from tablename")  '--> return rows as a LIST
                  L = db.TableList '--> return table list in database

             ' or update query   (True: If need transactional query)
                  db.ExecuteNonQuery("update tablename set fieldname = 'forexample' where key=1",True)  
        Catch
              MsgBox(LastException.Message,"Error Occured")
        End Try
.
.
.


You can also write create, update or delete queries.
You must copy MSSQL.jar, MSSQL.xml and jtds-1.2.5.jar files to your addititonal library folder.

You must add Manifest
AddPermission("android.permission.INTERNET")
AddPermission("android.permission.ACCESS_NETWORK_STATE")​

I wish to be useful.

Note: Be carefully working with databases, responsibility for problems caused by this library is yours.
 

Attachments

  • LibraryMsSQLSample.zip
    296.7 KB · Views: 1,927
  • MSSQL_Library_1.01.zip
    5.9 KB · Views: 1,821
Last edited:

mrumball

Member
Licensed User
Longtime User
Instances

Hi,
Thanks for the library. However your code only allows connection to the default instance on Ms SQL. It would be great if you could allow for connection to other Instances.

Martin
 

quaker

Member
Licensed User
Longtime User
Hi thanks for your library.

If there any chance to execute "stored procedures" with parameters ,and returning info(in case of select in stored procedure).

If it could be done,i gloud very glad to thanks to that person the effort.I need something like that and i think more people do.

Happy Programming! ^^
 

enrico

Active Member
Licensed User
Longtime User
Null values

How do you solve the problem of reading null values​​ in a table, which causes the java.lang.NullPointerException ?
 

fox96

Member
Licensed User
Longtime User
Hi, sorry for my english.

I'm trying your library.
Functioning properly.

But if I put in the manifest
Android: targetSdkVersion = "11"
gives me error
android.os.NetworkOnMainThreadException
 

jack007

New Member
Licensed User
Longtime User
You must add Manifest
AddPermission("android.permission.INTERNET")
AddPermission("android.permission.ACCESS_NETWORK_STATE")​

I wish to be useful.

Note: Be carefully working with databases, responsibility for problems caused by this library is yours.

How to add
AddPermission("android.permission.INTERNET")
AddPermission("android.permission.ACCESS_NETWORK_STATE")​
to Manifest ( where is the files?)
Thank you!
 

jack007

New Member
Licensed User
Longtime User
Help me to connect MSSQL

There is a table (the name is test) in the MSSQL Database (mytest)
my code is

Sub Activity_Create(FirstTime As Boolean)

a.setDatabase("127.0.0.1","mytest","sa","sa")

L = a.TableList

but I always get the message "Records Not Found".
Why?
please help me.
Thank you!
 

Rafal Galewski

Member
Licensed User
Longtime User
Basic4android 2.52

Please try update MSSQL Library Your project to Basic4android 2.52.
In my opinion is some problem with new version 2.52
 

Rafal Galewski

Member
Licensed User
Longtime User
Basic4Android problem with work 2.52

I Use update from version 2.50 to 2.52
And the old project have a problem with correctly work.
IDE in Debug and Relese is very slowly.
Always wait for IDE.( waiting for IDE connection)

I can't work on this version .
What I can do to better use 2.52 version .
Can I back to version 2.50 with project also ?

2.52 - should be a BETA not final version

I have also this problem:

Connected to B4A-Bridge (Wifi)
Ignoring event (too many queued events: CallSubDelayed - UpdateStatus)
sending message to waiting queue (CallSubDelayed - UpdateStatus)
Ignoring event (too many queued events: CallSubDelayed - UpdateStatus)


When I use a more simple project.
I add MSSQL 1.01 library and I try read some data from database.
I use debug mode and I have information from phone application No response without any errors.
What is wrong.
All projects work correctly with libraryes.
When I update version from 2.50 to 2.52 I have only problems.
Maybe library aslo are update ?


Where is the problem ???
Please help.

Now all project can't work correctly.
When I return to version 2.50 also no work.
Maybe library are also change when I change version to 2.52 from 2.50 ?

I have also this problem:

Connected to B4A-Bridge (Wifi)
Ignoring event (too many queued events: CallSubDelayed - UpdateStatus)
sending message to waiting queue (CallSubDelayed - UpdateStatus)
Ignoring event (too many queued events: CallSubDelayed - UpdateStatus)


When I use a more simple project.
I add MSSQL 1.01 library and I try read some data from database.
I use debug mode and I have information from phone application No response without any errors.
What is wrong.
All projects work correctly with libraryes.
When I update version from 2.50 to 2.52 I have only problems.
Maybe library aslo are update ?


Where is the problem ???
Please help.

Now all project can't work correctly.
When I return to version 2.50 also no work.
Maybe library are also change when I change version to 2.52 from 2.50 ?
Edit/Delete Message




LogCat connected to: B4A-Bridge: samsung GT-I9300-353922050119302
--------- beginning of /dev/log/main
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (service1) Create **
** Service (service1) Start **
** Service (service1) Destroy **
** Service (service1) Create **
** Service (service1) Start **
** Service (service1) Destroy **
** Service (service1) Create **
** Service (service1) Start **
Connected to B4A-Bridge (Wifi)
Installing file.
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
Streams_terminated
sending message to waiting queue (CallSubDelayed - UpdateStatus)
Connected to B4A-Bridge (Wifi)
sending message to waiting queue (CallSubDelayed - UpdateStatus)
Installing file.
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
--------- beginning of /dev/log/system
** Activity (main) Pause, UserClosed = true **
running waiting messages (2)
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
Installing file.
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 379)
java.lang.NullPointerException
at com.tomlost.MSSQL.MSSQL.QueryExecute(MSSQL.java:138)
at com.tomlost.MSSQL.MSSQL.Query(MSSQL.java:42)
at com.tomlost.library.main._activity_create(main.java:379)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:167)
at com.tomlost.library.main.afterFirstLayout(main.java:89)
at com.tomlost.library.main.access$100(main.java:16)
at com.tomlost.library.main$WaitForLayout.run(main.java:74)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4517)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
at dalvik.system.NativeStart.main(Native Method)
java.lang.NullPointerException
** Activity (main) Pause, UserClosed = false **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Resume **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
Installing file.
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Pause, UserClosed = false **
main_activity_pause (B4A line: 219)
End Sub
java.lang.NullPointerException
at com.tomlost.library.main._activity_pause(main.java:586)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:167)
at com.tomlost.library.main.onPause(main.java:184)
at android.app.Activity.performPause(Activity.java:4631)
at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1199)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2707)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2676)
at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:2654)
at android.app.ActivityThread.access$800(ActivityThread.java:128)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1168)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4517)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
at dalvik.system.NativeStart.main(Native Method)
java.lang.NullPointerException
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
 
Last edited:

Rafal Galewski

Member
Licensed User
Longtime User
java.lang.NullPointerException - no always MSSQL library 1.01

But this problem is not always.
Sometimes I start debuger and all query are corrected answer.
But many times I have a no response problem.
look in Log.



LogCat connected to: B4A-Bridge: samsung GT-I9300-353922050119302
--------- beginning of /dev/log/main
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (service1) Create **
** Service (service1) Start **
** Service (service1) Destroy **
** Service (service1) Create **
** Service (service1) Start **
** Service (service1) Destroy **
** Service (service1) Create **
** Service (service1) Start **
Connected to B4A-Bridge (Wifi)
Installing file.
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
Streams_terminated
sending message to waiting queue (CallSubDelayed - UpdateStatus)
Connected to B4A-Bridge (Wifi)
sending message to waiting queue (CallSubDelayed - UpdateStatus)
Installing file.
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
--------- beginning of /dev/log/system
** Activity (main) Pause, UserClosed = true **
running waiting messages (2)
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
Installing file.
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 379)
java.lang.NullPointerException
at com.tomlost.MSSQL.MSSQL.QueryExecute(MSSQL.java:138)
at com.tomlost.MSSQL.MSSQL.Query(MSSQL.java:42)
at com.tomlost.library.main._activity_create(main.java:379)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:167)
at com.tomlost.library.main.afterFirstLayout(main.java:89)
at com.tomlost.library.main.access$100(main.java:16)
at com.tomlost.library.main$WaitForLayout.run(main.java:74)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4517)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
at dalvik.system.NativeStart.main(Native Method)
java.lang.NullPointerException
** Activity (main) Pause, UserClosed = false **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Resume **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
Installing file.
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Pause, UserClosed = false **
main_activity_pause (B4A line: 219)
End Sub
java.lang.NullPointerException
at com.tomlost.library.main._activity_pause(main.java:586)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:167)
at com.tomlost.library.main.onPause(main.java:184)
at android.app.Activity.performPause(Activity.java:4631)
at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1199)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2707)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2676)
at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:2654)
at android.app.ActivityThread.access$800(ActivityThread.java:128)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1168)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4517)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
at dalvik.system.NativeStart.main(Native Method)
java.lang.NullPointerException
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
main_activity_create (B4A line: 118)
L= a.Query("Select val from dbo.sets where SalonID=" & SalonID & " AND ValueName ='PTSTYPE'")
java.lang.NullPointerException
at com.tomlost.MSSQL.MSSQL.QueryExecute(MSSQL.java:138)
at com.tomlost.MSSQL.MSSQL.Query(MSSQL.java:42)
at com.tomlost.library.main._activity_create(main.java:410)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:167)
at com.tomlost.library.main.afterFirstLayout(main.java:89)
at com.tomlost.library.main.access$100(main.java:16)
at com.tomlost.library.main$WaitForLayout.run(main.java:74)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4517)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
at dalvik.system.NativeStart.main(Native Method)
java.lang.NullPointerException
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
Installing file.
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Connected to B4A-Bridge (Wifi)
** Activity (main) Pause, UserClosed = true **
Installing file.
PackageAdded: package:com.tomlost.library
** Activity (main) Create, isFirst = true **
main_activity_create (B4A line: 124)
L= a.Query("Select val from dbo.sets where SalonID=" & SalonID & " AND ValueName ='PTSTYPE'")
java.lang.NullPointerException
at com.tomlost.MSSQL.MSSQL.QueryExecute(MSSQL.java:138)
at com.tomlost.MSSQL.MSSQL.Query(MSSQL.java:42)
at com.tomlost.library.main._activity_create(main.java:417)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:167)
at com.tomlost.library.main.afterFirstLayout(main.java:89)
at com.tomlost.library.main.access$100(main.java:16)
at com.tomlost.library.main$WaitForLayout.run(main.java:74)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4517)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
at dalvik.system.NativeStart.main(Native Method)
java.lang.NullPointerException
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Resume **
 

fox96

Member
Licensed User
Longtime User
Hi, my test

B4a 2.50 targetSdkVersion="9" : OK
B4a 2.50 targetSdkVersion="11" : android.os.NetworkOnMainThreadException

B4a 2.52 targetSdkVersion="9" : OK
B4a 2.52 targetSdkVersion="11" : NO ERROR NO DATA (list not inizialize)


I saw that there is a version 3.0 of jtds library.

Sorry for my english :)
 

Rafal Galewski

Member
Licensed User
Longtime User
Hi, my test

B4a 2.50 targetSdkVersion="9" : OK
B4a 2.50 targetSdkVersion="11" : android.os.NetworkOnMainThreadException

B4a 2.52 targetSdkVersion="9" : OK
B4a 2.52 targetSdkVersion="11" : NO ERROR NO DATA (list not inizialize)


I saw that there is a version 3.0 of jtds library.

Sorry for my english :)

Thank You very much for answer.

I use jtds-1.2.5.jar of jtds library and B4a 2.52
About target version I have set targetSdkVersion="4"




Now I have like this:

LogCat connected to: 4df1178368066fa9
--------- beginning of /dev/log/main


mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
###SPEAKER_ON_OFF_DELAY
mHandler: mInCallScreen.getUpdatedInCallControlState().speakerEnabled : true
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)
mSpeakerButton.setEnabled(inCallControlState.speakerEnabled)



--------- beginning of /dev/log/system
** Activity (main) Create, isFirst = true **


** Activity (main) Resume **
** Service (service1) Create **
** Service (service1) Start **
** Service (service1) Destroy **
** Service (service1) Create **
** Service (service1) Start **
Connected to B4A-Bridge (Wifi)
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:anywheresoftware.b4a.designer
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:lojalka.test
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:lojalka.test
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
@@@ ABORTING: INVALID HEAP ADDRESS IN dlfree
Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)

** Activity (main) Resume **


Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:lojalka.test
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (service1) Destroy **
** Activity (main) Pause, UserClosed = true **
Ignoring event as service was destroyed.
** Activity (main) Create, isFirst = true **
 
Last edited:

Rafal Galewski

Member
Licensed User
Longtime User
Hi, my test

B4a 2.50 targetSdkVersion="9" : OK
B4a 2.50 targetSdkVersion="11" : android.os.NetworkOnMainThreadException

B4a 2.52 targetSdkVersion="9" : OK
B4a 2.52 targetSdkVersion="11" : NO ERROR NO DATA (list not inizialize)


I saw that there is a version 3.0 of jtds library.

Sorry for my english :)


Please try also with many queys like this L= a.Query("Select val from dbo.sets where ValueName ='DB_VER'")
I have to read all settings - I have 30 querys .


My test:



B4a 2.52 targetSdkVersion="9" : "Waiting for IDE debbuger connect" - and then No response from application / No answer.
B4a 2.52 targetSdkVersion="11" : android.os.NetworkOnMainThreadException

I don't undestand very is a problem ?






How You use jtds-1.3.0.jar with MYSQL 1.1 library and B4a 2.52 ?

When I try to use it I have error :
java.lang.classNotFoundException
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
I'm not familiar with this library implementation. However it seems like it handles the network on the main thread. This is not allowed on Android 4+ (except when targetSdkVersion is set to older versions).

Communication should always be done in the background. Otherwise your program will not work reliably. I recommend you to use the web service approach.
 

Rafal Galewski

Member
Licensed User
Longtime User
I'm not familiar with this library implementation. However it seems like it handles the network on the main thread. This is not allowed on Android 4+ (except when targetSdkVersion is set to older versions).

Communication should always be done in the background. Otherwise your program will not work reliably. I recommend you to use the web service approach.

Thank You very much for answer.

I would like connect to MSSQL Server direct.
I do not want use web service.

I have set targetSdkVersion = 1 or also try targetSdkVersion = 4

I have a strange effect.
When I run the debug mode without breakpoint hangs on waiting for the debugger.

But When you insert a breakpoint then work with the library. Dll works correctly and performs all queries without error.

I do not understand what affects breakpoint in this case.

Please help and hint.
What do Erel + Hasan please help me
 
Top