Italian connessione jdbc con host

3394509365

Active Member
Licensed User
Longtime User
buongiorno a tutti, è da un po che tento di collegarmi al mio sqlserver ma non riesco in nessun modo.

B4X:
Public mysql As JdbcSQL
    Private driver As String = "com.mysql.jdbc.Driver"
    'Private jdbcUrl As String = "jdbc:mysql://192.168.0.2:1433/SQLTutorial"
    Private jdbcUrl As String = "jdbc:mysql://laptop-31m6jo38:1433/SQLTutorial"
    
    Private Username As String = "pippo"
    Private Password As String = "xxxx"

ho seguito tutti i video possibili e immaginabili, ho provato vi aip e via hist ma niente.

Qualcuno mi dice che è colpa del firewall.
Questo è il messaggio di errore

(GaiException) android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)
 

3394509365

Active Member
Licensed User
Longtime User
per adesso ho risolto così:
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"
 

micro

Well-Known Member
Licensed User
Longtime User
per adesso ho risolto così:
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"
Perchè come ha detto il Buon LucaMs hai usato il driver giusto per Sql
 

3394509365

Active Member
Licensed User
Longtime User
per adesso riesco solo con l' IP con il nome host ancora no. Avete idea ?

Con JDBC non ci riesco proprio.
 
Last edited:

LucaMs

Expert
Licensed User
Longtime User
Prova così:
B4X:
Dim pool As ConnectionPool
Dim dbname As String = "SQLTutorial"
Dim JdbcUrl As String = "jdbc:mysql://localhost/" & dbname & "?characterEncoding=utf8"
Dim driverClass As String = "com.mysql.jdbc.Driver"
Dim dbuser As String = "NomeUtente"
Dim dbpassword As String = "Password"
pool.Initialize(driverClass, JdbcUrl, dbuser, dbpassword)
 
Top