Android Question Any Way to use SQL and JSQL in the same program?

MrKim

Well-Known Member
Licensed User
Longtime User
JSQL is OK for getting stuff off the server, but it is forward only recordsets. I would like to use SQL for the stuff stored locally, I really need to move back and forth.
Barring that is there way/some examples of how to quickly store an entire recordset in a map or list?

Thanks for any help. I will sure feel better when I feel Like I know enough to start contributing here instead of just asking questions.:D
 

OliverA

Expert
Licensed User
Longtime User
On Android, jSQL is local (look at the Initialize method). If you want remote SQL, you need to either use another library or go with something like jRDC2.
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
On Android, jSQL is local (look at the Initialize method). If you want remote SQL, you need to either use another library or go with something like jRDC2.
Not sure what you mean by local, but I am using jSQL with the jtds driver now to connect to SQL Server on a Windows server and it works fine. The powers that be here don't want a middleware connection.like jrdc. These are closed, internal networks and they don't want yet another piece of software to manage and support.
 
Last edited:
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Not sure what you mean by local, but I am using jSQL with the jtds driver now to connect to SQL Server on a Windows server and it works fine. The powers that be here don't want a middleware connection.like jrdc adn rightly so
That's because sometimes I have no clue what I'm talking about. I was not aware (not been around the block long enough) that jSQL could be used on B4A. If that's what your doing, and going by this post (https://www.b4x.com/android/forum/threads/jsql.40056/) you could also use jSQL and create a local SQLite database with the proper driver. You could also just use B4A's SQL lib. I still stand by DBUtils ExecuteMap as a means to get a map from a SQL SELECT call. Then check out DBUtils InsertMaps method. This way you could use ExecuteMap to pull info out of one db and use InsertMaps to insert it to another db. You can either use DBUtils or you can just look at the source of those two methods to see how it is done and write your own methods.
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
I will sure feel better when I feel Like I know enough to start contributing here instead of just asking questions
Or you can be crazy like me and just help. This may lead to answering questions wrongly (see here), but I take those mistakes as learning experiences (I learned about the use of jSQL in B4A). :):D

Edit: Actually also learned that the SQL library for B4A is just SQL, not jSQL. Never noticed, since I'm going from B4J to B4A now and then. I really need to pay more attention.
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
That's because sometimes I have no clue what I'm talking about. I was not aware (not been around the block long enough) that jSQL could be used on B4A. If that's what your doing, and going by this post (https://www.b4x.com/android/forum/threads/jsql.40056/) you could also use jSQL and create a local SQLite database with the proper driver. You could also just use B4A's SQL lib. I still stand by DBUtils ExecuteMap as a means to get a map from a SQL SELECT call. Then check out DBUtils InsertMaps method. This way you could use ExecuteMap to pull info out of one db and use InsertMaps to insert it to another db. You can either use DBUtils or you can just look at the source of those two methods to see how it is done and write your own methods.
Yes, execute map sounds like exactly what I am looking for. FYI the issue is JSQL and SQL both impliment 'AS SQL' type so there doesn''t appear to be a way to use them both at the same time. JSQL connects directly to SQL server. SQL doesn't. JSQL only supports forward only record sets. I need something akin to a dynamic recordset type for the local data which SQL supports So it looks like DBUTILS might be my best option.

Thanks for your help.
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
FYI the issue is JSQL and SQL both impliment 'AS SQL' type so there doesn''t appear to be a way to use them both at the same time
If one were good enough, one could take B4J's source of the jSQL library and modify it so that 'AS SQL' becomes something different, by renaming the 'SQL' class to something else (and, of course, all the references to that class within the source file).
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
If one were good enough, one could take B4J's source of the jSQL library and modify it so that 'AS SQL' becomes something different, by renaming the 'SQL' class to something else (and, of course, all the references to that class within the source file).
Sigh, yeah, I am not that good. I looked at it and I am tempted but it is a project for another day. I modified the code for a "Swipe" routine once and it took me two days and while I got it to work I never could figure out how to change the name(I wanted both routines-they did slightly different things).
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
I plan to release a B4A version of jSQL (SqlJdbc) that is based on B4J jSQL library and doesn't conflict with B4A SQL library.
:):D:):D:):D You are awesome!
Rough idea when?
(On my wishlist for that would be Client side cursors and/or Snapshot type recordsets. Then I wouldn't need SQL.)
 
Upvote 0
Top