Android Question Trying to connect to an AceQL middleware server using JDBC

calloatti

Member
Licensed User
I am trying to connect to an AceQL server using JDBC.


I downloaded the jdbc driver jar from here:



I placed the jar in the configured additional libraries folder.

I created a default B4XPages B4A project, added the JdbcSQL library, and added the line to Main:

B4X:
#AdditionalJar: aceql-http-client-jdbc-driver-all-9.1

I edited the B4XMainPage code:

B4X:
Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
    
    Private jdbc As JdbcSQL
    
End Sub

Private Sub Button1_Click
   
    'http://192.168.1.3:9090/aceql/database/alal/username/testuser/login?password=testuser
   
    Private driverclass As String = "com.aceql.jdbc.driver.free.AceQLDriver"
   
    Private jdbcurl As String
   
    Private url As String = "http://192.168.1.3:9090/aceql"
   
    Private username As String = "testuser"
   
    Private password As String = "testuser"
   
    Private database As String = "alal"
   
    jdbcurl = "jdbc:aceql:" & url & "/" & database
   
    jdbc.Initialize2(driverclass, jdbcurl, username, password)
   
End Sub

When I run the project and click on the button, I get this error:

B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
b4xmainpage_button1_click (java line: 66)
java.sql.SQLException: No suitable driver found for jdbc:aceql://http://192.168.1.3:9090/aceql/alal
    at java.sql.DriverManager.getConnection(DriverManager.java:605)
    at java.sql.DriverManager.getConnection(DriverManager.java:218)
    at anywheresoftware.b4j.objects.SQL.Initialize2(SQL.java:56)
    at b4a.example.b4xmainpage._button1_click(b4xmainpage.java:66)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
    at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
    at android.view.View.performClick(View.java:7448)
    at android.view.View.performClickInternal(View.java:7425)
    at android.view.View.access$3600(View.java:810)
    at android.view.View$PerformClick.run(View.java:28305)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:223)
    at android.app.ActivityThread.main(ActivityThread.java:7656)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

1. I am guessing that "jdbc:aceql:" is the correct string to use.
2. I am guessing that "com.aceql.jdbc.driver.free.AceQLDriver" is the proper driverclass to use.

Question 1 : How do I determine what goes after "jdbc:" I know its "mysql" for MySql, but where does that come from?

Question 2: Does the JDBC driver aceql-http-client-jdbc-driver-all-9.1.jar work with B4A? Are there any specific requirements?

Question 3: How do I solve the error posted above?

Notes:

I am just getting started experimenting with this, I managed to set up and configure properly the AceQL server on my Windows dev machine and it seems to be working fine.


Properly displays a response:

{ "status": "OK", "connection_id": "919108734", "session_id": "roe49rhb6x6biu3h8bzqhr0sfw" }
 

Attachments

  • aceql-test.zip
    13.9 KB · Views: 159
Last edited:

calloatti

Member
Licensed User
Yes. The jdbc driver must be compatible with Android.
You need to check with their documentation.
The docs seem to state that the driver is compatible with android:

The source code for the driver is public in that repo. I downloaded the full jar with all dependencies from the main site.
 
Upvote 0

calloatti

Member
Licensed User
Why aren't you using jRDC2 as a middleware???
This seems to be more flexible, there is no need to add/configure each request in the middleware, it can run as a windows service, I can add multiple users and enable/disable access per user, and also it could be used as a drop in replacement for the app I already have using jdbcsql (If the jdbc driver worked).

In short, I am just guessing that I should use "aceql" in the jdbcurl string, I have no idea where to get the correct string to use for the driver, I guess that is why I am getting the "No suitable driver found for jdbc:aceql:..." error.
 
Upvote 0

calloatti

Member
Licensed User
Best to try it with B4J.
Why? I have noticed you suggesting that in many jdbc related threads, but dont know why its better to use B4J in these scenarios. I guess it works more closely to how JAVA works? I would have to get into B4J a bit then, I have never even touched it.

Sorry about all the questions, this is my first real app deployed using B4A, and it has been only 3 weeks since deployment, I am still learning a lot and optimizing everything as I go along and learn.
 
Upvote 0
Top