Android Question Adding Library and referencing to it.

Backalife

Member
Gents, sorry if I am getting confused about such an elementary thing,
I am trying to reproduce the JDBC project Here with SQL Server instead of MySQL so I proceeded by:
1- Setting the Additional Libraries folder see Attachment "AdditionalLibs"
2 - Dropped the JDBC Library downloaded from Here onto the Additional Libraries Folder: Attachment "JDBC_Jar_Added"
3 - Importing the library using #AdditionalJar "mssql-jdbc-8.2.2.jre11"

But I am still getting an error about missing library to the jdbcSQL variable declared in the code.

Thank you.
 

Attachments

  • AdditionalLibs.png
    AdditionalLibs.png
    25.4 KB · Views: 234
  • JDBC_Jar_Added.png
    JDBC_Jar_Added.png
    17.7 KB · Views: 238

Backalife

Member
Thank you Erel for your help,
These are the Globals and Attribs statments, I hope I am not missing something up:
in fact I tried to make it work with both mssql-jdbc-8.2.2.jre11 and mssql-jdbc-7.2.2.jre11 but in vain.

Jdbc object not recognized:
#Region  Project Attributes
    #ApplicationLabel: SQL Example
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
'    #AdditionalJar: mssql-jdbc-8.2.2.jre11
    #AdditionalJar: mssql-jdbc-7.2.2.jre11
  
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
    #BridgeLogger: True
    DriverClass="com.microsoft.sqlserver.jdbc.SQLServerDriver"
#End Region

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

  
End Sub

Sub Process_Globals
   Public sqlserver As JdbcSQL
   Private driver As String = "com.microsoft.sqlserver.jdbc.SQLServerDriver"
   Private jdbcUrl As String = "jdbc:sqlserver://172.23.26.81:1433"
   Private Username As String = "user"
   Private Password As String = "password"
End Sub

and this is the Log:
Main - 78: Undeclared variable 'crsr' is used before it was assigned any value.
Main - 74: Undeclared variable 'sqlserver' is used before it was assigned any value.
Main - 66: Undeclared variable 'sqlserver' is used before it was assigned any value.
Main - 57: Undeclared variable 'sqlserver' is used before it was assigned any value.
Main - 75: Unknown type
Main - 28: Unknown type: jdbcsql<br />Are you missing a library reference?
Main - 29: Unused variable 'driver'. (warning #9)
Main - 30: Unused variable 'jdbcUrl'. (warning #9)
Main - 31: Unused variable 'Username'. (warning #9)
Main - 32: Unused variable 'Password'. (warning #9)
Main - 69: Sub 'ListAnimals' is not used. (warning #12)
Layout file 'main.bal' is not used. Are you missing a call to Activity.LoadLayout? (warning #16)
Library 'PreferenceActivity' is not used. (warning #32)
Thanks again.
 
Last edited:
Upvote 0

Backalife

Member
Negative Erel, my Libraries Manager shows no JdbcSQL item.
Here is a snapshot of it.
 

Attachments

  • LibTab.png
    LibTab.png
    27.1 KB · Views: 219
Upvote 0

MicroDrie

Well-Known Member
Licensed User
Longtime User
Erel point to link at post 6 and follow the link we can read:
The SQL type was renamed to JdbcSQL and ResultSet was renamed to JdbcResultSet, this allows using it together with the SQL library.

Contracts has always imported things in small letters. This post has a picture very small overview of all used and unused libraries. So what do we see if we blow up the small picture at post 5:
1588710054778.png

No SQL library selected. So perhaps it helps to select also the SQL library?
 
Upvote 0
Top