Android Question Sql1.InitializeAsync - can anyone help with the Library to reference?

Cableguy

Expert
Licensed User
Library : SQL, its part of the standard lib set.

You need to have something like "Dim Sql1 as SQL" , usually in process_globals
 

SHOLA KUKU

Member
Licensed User
Thanks Cableguy.

But error says:"Unknown member:initializeAsync

sql1.InitializeAsync("Connect","net.sourceforge.jtds.jdbc.Driver","jdbc:jtds:sqlserver://127.0.0.1:1433;databseName=Perfectdata;user=gst;password=gst2000")
 

Cableguy

Expert
Licensed User
hummm….

Where did you get that line from? From a sample code?
It looks like a RDC connection...
 

SHOLA KUKU

Member
Licensed User
Yes, from a sample code.

Can someone help with a sample program to connect to MSSQL Server.

I followed the video on JRDBC2 on mySQL by Erel but am lost on applying it to MSSQL example

Thanks.
 

OliverA

Expert
Licensed User
Please note, that the library in B4A is now included and is called jSQL. Previously, it was an external library named JdbcSQL. You cannot (that I'm aware of - I've not seen any working code) use Microsoft's drivers with Android. You have to rely on the jTDS JDBC drivers that have not been updated since 2013.

1) Read this: https://social.msdn.microsoft.com/F...-jdbc-driver-ms-sql-android?forum=sqlsecurity Note how it mentions that the jTDS drivers do not support/can do everything that the MSSQL drivers can do
2) Read this: https://www.b4x.com/android/forum/threads/mssql-jdbc-minimalistic-example.90548/#content Again, MS drivers do not work. jTDS does. Read my mini-rant. Be aware what you are getting yourself into. Post #12 has a working sample that you can use to glean the proper driver and jdbcurl properties for your InitializeAsync method. The same post also mentions that your out of luck if you are targeting Android below 7.
3) Check out: https://www.b4x.com/android/forum/t...ly-connect-to-remote-databases.84016/#content The sample program for android is a good starting point. The DB stuff is handled in the Starter server (as is recommended).
4) See: https://www.b4x.com/android/forum/threads/jrdc2-how-to-make-it-work-on-b4a.109963/#post-686572 Shows you what you need to change to the sample in point #3 to make it work with the now included jSQL library

After I wrote all of this I noticed
I followed the video on JRDBC2 on mySQL by Erel but am lost on applying it to MSSQL exampl
What? You are trying to get jRDC2 working with MSSQL? That is a totally different issue than post #1 and should not be posted here (B4A) since jRDC2 is a B4J application.

I think there is some confusion going on about how you want to connect to MSSQL.

1) Are you trying to connect to MSSQL directly via your B4A application? Then my points above apply.
2) Are you trying to connect to your MSSQL database via jRDC2? Then what is the issue?
A - You can't get jRDC2 to connect to MSSQL - Post a question in the B4J forum.
B - You can't connect to jRDC2 from your B4A application - then start a new post in B4A explaining the issue. InitializeAsync has nothing to do with connecting to jRDC2.​
 

SHOLA KUKU

Member
Licensed User
Thanks Oliver for your detailed explanations. I appreciate your assistance. I will follow all the referenced links provided.

But looking at the Library Reference folder in B4A, I can only see SQL, no jSQL. Any hint?
 
Top