Android Tutorial Tutorial of connecting Android to MS SQL Server using jRDC2

Hi

Here is a tutorial that shows the steps of how to make an Android connection to MS SQL Server using jRDC2.

Download tutorial here:
Attached the Mobile Project in B4A and the JRDC2 Project in B4J

Any questions please ask in the forum

Bladimir Silva Toro
Teacher programming software
 

Attachments

  • Example B4A.zip
    10.4 KB · Views: 872
  • jRDC SQL Server.zip
    5.2 KB · Views: 806
  • Script TestSQLServer.txt
    857 bytes · Views: 732

Vikjh

Member
Licensed User
I use online method to get commands:
B4X:
Public Sub GetSQLCommand(SqlKey As String)As String
    Dim GetSQL as String="SELECT [Sql] FROM JRDC_SQL WHERE [Sql] is not null AND [Key]=?"
    Dim res As String = pool.GetConnection.ExecQuerySingleResult2(GetSQL,Array As String(SqlKey)).ToLowerCase.trim
    Return res
End Sub
I think this is more convenient than the commands in a text file
 
Last edited:

Shelby

Active Member
Licensed User
In step 6 of your tutorial, I find that my config.properties file is a pdf; your file in the tutorial is a text file. I get an error when I double click the pdf. The error message says: Adobe Acrobat Reader could not open 'config.properties' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded). I'll look into my c:\\drive at the file.
 

Bladimir Silva Toro

Active Member
Licensed User
Hello @Shelby

Here are the steps to configure the notepad as editor for the config.properties file in JRDC2

1. Go to configure the external editor

1609767693576.png


2. Type the path to Notepad in my case it would be: C: \ Windows \ system32 \ notepad.exe

1609767767087.png



3. Verify that Notepad already appears as your default editor.

1609767859275.png


Any other questions let me know it will be a pleasure to help you
 

Shelby

Active Member
Licensed User
Thanks, however, I don't have a file or folder called notepad.exe. In my Windows 10 System32 folder, I have an empty notepad file called 'notepad' of type Application. Edited: What I did was to remove the config.properties file which was a PDF I think it was and reintroduce it after opening it as a text file as Jose suggested in post # 6. Now I'll see if I can proceed as your tutorial instructs me to.
 
Last edited:

Shelby

Active Member
Licensed User
Thanks kisoft, I solved the problem with my above **edited post #9. Now I'm tryng to get a URL either for my browser or my computer for the step #7 in Bladimir's tutorial. It's not clear for me to understand which URL I need.
 

José J. Aguilar

Expert
Licensed User
Same computer
If it's the same computer, you can write "localhost"
B4X:
JdbcUrl=jdbc:jtds:sqlserver://localhost/TestSQLServer

That's because your jRDC2 server and your MS SQL server are in the same computer.
In the client (B4A app?) you should write your pc local network IP (you can get it going to console and writing "ipconfig", or in your network card properties, it will be something similar to 192.168.0.x or 192.168.1.x"
 

Shelby

Active Member
Licensed User
I don't know why when using run>ipconfig, a window blinks but does not display (windows10). I'll try the network card properties (I'll do search to find the card) OK I found it; so I put the 192.168..... in the file, not local host like you mentioned in post #14, right?
 
Last edited:

Shelby

Active Member
Licensed User
Oh yeah the cmd first; I forgot, Thanks. It verified that the IPv4 address is the same as the settings entry...... so I put the 192.168..... in the file, not local host like you mentioned in post #14, right? Maybe I should write 'local host'. Right now it reads:

#DATABASE CONFIGURATION
DriverClass=com.mysql.jdbc.Driver
JdbcUrl=jdbc:mysql://localhost/test?characterEncoding=utf8
User=root
Password=
#Java server port
ServerPort=17178
 
Last edited:
Top