cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

load data from sql server : python works well but spark does not

Hoviedo
New Contributor II

Hi, i have a problem with my on-premise sql conection from databricks.

i have my python code wich use pymssql and it is working well but my spark code doest not and i am using the same credential for both, my spark code is 

"""

# Read data from SQL Server into DataFrame
df = spark.read \
    .format("jdbc") \
    .option("url", f"jdbc:sqlserver://{host}:1433;database={db};user={user};password={password}") \
    .option("dbtable", "{table}") \
    .load()
"""
i am using the 9.1 LTS (includes Apache Spark 3.1.2, Scala 2.12) and the com.microsoft.azure:spark-mssql-connector_2.12:1.2.0 connector which are compatible.
the sql autentication is mixed
 
the return error is "com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user"
i dont know what could happen because the connector and the version of spark are compatible and the python code works well so the credential are fine, what else could be going on? 
 
thanks
 
0 REPLIES 0
Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.