Android Question [Solved] JdbcSQL and SQL Server

Status
Not open for further replies.

makis_best

Well-Known Member
Licensed User
Longtime User
Hi

I read allot inside the forum about how to connect jdbcSQL with Sql server but I can't understand it.
All info are split in several post confusing very much specially newbies like me.

There are no complete tutorial - example saying from start to end how to do it?

Thank you.
 

alienhunter

Active Member
Licensed User
Longtime User
Hi to all
it seems the
#AdditionalJar: jtds-1.3.0.jar
solves all trouble , i had the same trouble connecting in B4A, in B4J jtds-1.3.1 runs fine
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
you use b4a or b4j?
I have the same connection problem.
i use b4a.
Cau you post anythings?
Take post#10 and modify it according to post#20. That is a working solution for @makis_best. In the other thread that you placed a question/comment, @MrKim posted a working (for him) sample (see https://www.b4x.com/android/forum/threads/mssql-jdbc-minimalistic-example.90548/#post-591195). If non of this seems to help (you actually try the solutions for yourself), then create a new thread and include
1) B4A version
2) What jdbc drivers you are using (jtds or MSSQL, please note that you may be out of luck when using MSSQL drivers)
3) Version(s) of the MS SQL server(s) that you are trying to connect
4) Can your server already be connected to from your network. How are other programs/devices accessing it (what IP/server name/port/dbname/etc configuration are they using to access your server(s)?)
5) Network topology (are you on the same network (your WiFi network is on the same LAN without restrictions), are you trying to access the server remotely, etc. etc. etc.)
7) Code that you are using to try to connect
8) Any and all things you have tried and the various error messages that you have encountered
And whatever other information you can provide that relates to your issue. Until then, it will be really hard to give a helping hand.
 
Upvote 0

3394509365

Active Member
Licensed User
Longtime User
B4X:
#AdditionalJar: jtds-1.3.1.jar
B4X:
Private driver As String = "net.sourceforge.jtds.jdbc.Driver"
    Private jdbcUrl As String = "jdbc:jtds:sqlserver://192.168.0.2;integratedSecurity=false;databaseName=SQLTutorial;"
 
   Private Username As String = "pippo"
   Private Password As String = "xxxx"


even if it is B4A for now I have solved this
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
if it is B4A for now I have solved this
In B4J, I would go with the MS JDBC drivers, since they are more modern and offer secure connectivity to you MS SQL server.
Buonasera! (via Google)
 
Upvote 0

M.SALIM

Member
hello

I'm developing an App on Android that will connect to a database online & offline mode.
The Online Database is MSSqlServer using JdbcSQL and the local database on the device is SQLlite.

When connecting to the Online database it works perfectly, but failed to connect to localDB when offline.
The Error is : java.lang.RuntimeException: Object should first be initialized.

Below is my sample code :


B4X:
If DBOnline  Then
        Dim myDBRemote As JdbcSQL
        myDBRemote.Initialize("net.sourceforge.jtds.jdbc.Driver",  myConnectionString)
        Dim myRS  As JdbcResultSet =myDBRemote.ExecQuery("SELECT * FROM CUSTOMERS")
    Else
        Dim myfolder As String = Starter.rp.GetSafeDirDefaultExternal("")
        Dim myDBlocal As JdbcSQL
        myDBlocal.InitializeSQLite(myFolder, "ABSDB.db",     True)
        Dim myRS As JdbcResultSet = myDBlocal.ExecQuery("SELECT * FROM CUSTOMERS")
    End If

Can anyone advise how to achieve this.
 
Upvote 0

udg

Expert
Licensed User
Longtime User
May I suggest you to start a new thread? Eventually sporting a link to the current one, if you find that your problem is related.
This will be useful for others when using the search feature of the Forum.
 
Upvote 0
Status
Not open for further replies.
Top