โ07-31-2024 05:25 AM
In the current version of databricks, previous methods to execute stored procedures seem to fail.
3 weeks ago
Hi, my issue was "resolved" when i switched to personal compute with 14.3 LTS ML Runtime. OAuth did not seem to make a difference since i still needed to use drivermanager at the end of the day. So if you need a temporary solution i would suggest trying that, but i do hope that there are plans for fixing this in the future.
# Write your SQL statement as a string
statement = """TRUNCATE TABLE dbo.test"""
# Fetch the driver manager from your spark context
driver_manager = spark._sc._gateway.jvm.java.sql.DriverManager
# Create a connection object using a jdbc-url, + sql uname & pass
con = driver_manager.getConnection(jdbc_url, user, password)
# Create callable statement and execute it
exec_statement = con.prepareCall(statement)
exec_statement.execute()
# Close connections
exec_statement.close()
con.close()
โ08-02-2024 06:10 AM
Hi @doodateika, You can use the built-in JDBC connector with OAuth2 authentication to execute stored procedures. Another approach is to use Databricks SQL Warehouses to execute your stored procedures.
โ08-02-2024 06:12 AM
Hi thanks for responding, how would i go about doing that? Do you have anything with more detail? Im glad to try whatever suggestions you have! ๐
3 weeks ago
I'm facing the same issue @Kaniz_Fatma , is there a working solution to execute a stored procedure?
3 weeks ago
Hi, my issue was "resolved" when i switched to personal compute with 14.3 LTS ML Runtime. OAuth did not seem to make a difference since i still needed to use drivermanager at the end of the day. So if you need a temporary solution i would suggest trying that, but i do hope that there are plans for fixing this in the future.
# Write your SQL statement as a string
statement = """TRUNCATE TABLE dbo.test"""
# Fetch the driver manager from your spark context
driver_manager = spark._sc._gateway.jvm.java.sql.DriverManager
# Create a connection object using a jdbc-url, + sql uname & pass
con = driver_manager.getConnection(jdbc_url, user, password)
# Create callable statement and execute it
exec_statement = con.prepareCall(statement)
exec_statement.execute()
# Close connections
exec_statement.close()
con.close()
3 weeks ago
can you create a connection to external data in unity catalog, and then:
use <connectiondb>;
exec <sp>
Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโt want to miss the chance to attend and share knowledge.
If there isnโt a group near you, start one and help create a community that brings people together.
Request a New Group