<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Call a Stored Procedure in Azure Synapse with input and output Params in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/call-a-stored-procedure-in-azure-synapse-with-input-and-output/m-p/50415#M28802</link>
    <description>&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;statement=&lt;/SPAN&gt;&lt;SPAN&gt;"EXEC procedurename&amp;nbsp; imputparametre , ? "&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;driver_manager = spark._sc._gateway.jvm.java.sql.DriverManager&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;con = driver_manager.getConnection(jdbcUrl, username, pwd)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;exec_statement = con.prepareCall(statement)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;exec_statement.registerOutParameter(&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;, spark._sc._gateway.jvm.java.sql.Types.VARCHAR)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;df=exec_statement.execute()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;# Close connections&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;result=exec_statement.getString(&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;display(result)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;exec_statement.close()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;con.close()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Fri, 03 Nov 2023 11:59:30 GMT</pubDate>
    <dc:creator>sivaram_bh</dc:creator>
    <dc:date>2023-11-03T11:59:30Z</dc:date>
    <item>
      <title>Call a Stored Procedure in Azure Synapse with input and output Params</title>
      <link>https://community.databricks.com/t5/data-engineering/call-a-stored-procedure-in-azure-synapse-with-input-and-output/m-p/4449#M1178</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;driver_manager = spark._sc._gateway.jvm.java.sql.DriverManager
connection = driver_manager.getConnection(mssql_url, mssql_user, mssql_pass)
connection.prepareCall("EXEC sys.sp_tables").execute()
connection.close()&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The above code works fine but however I am unable to capture the output Params from Stored Procedure &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone please share the snippet to capture output value&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 17:13:36 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/call-a-stored-procedure-in-azure-synapse-with-input-and-output/m-p/4449#M1178</guid>
      <dc:creator>Akshith_Rajesh</dc:creator>
      <dc:date>2023-05-12T17:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: Call a Stored Procedure in Azure Synapse with input and output Params</title>
      <link>https://community.databricks.com/t5/data-engineering/call-a-stored-procedure-in-azure-synapse-with-input-and-output/m-p/4450#M1179</link>
      <description>&lt;P&gt;I think there is an `executeQuery()` function that also works and returns a resultset. Something like this (I have not tested though):&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;conn = DriverManager.getConnection(url, username, password);
stmt = conn.createStatement();
sql = "SELECT * FROM mytable";
rs = stmt.executeQuery(sql);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 21:42:16 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/call-a-stored-procedure-in-azure-synapse-with-input-and-output/m-p/4450#M1179</guid>
      <dc:creator>Ryan_Chynoweth</dc:creator>
      <dc:date>2023-05-12T21:42:16Z</dc:date>
    </item>
    <item>
      <title>Re: Call a Stored Procedure in Azure Synapse with input and output Params</title>
      <link>https://community.databricks.com/t5/data-engineering/call-a-stored-procedure-in-azure-synapse-with-input-and-output/m-p/4451#M1180</link>
      <description>&lt;P&gt;If I print(rs) I am not receiving the expected result &lt;/P&gt;</description>
      <pubDate>Sat, 13 May 2023 10:15:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/call-a-stored-procedure-in-azure-synapse-with-input-and-output/m-p/4451#M1180</guid>
      <dc:creator>Akshith_Rajesh</dc:creator>
      <dc:date>2023-05-13T10:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: Call a Stored Procedure in Azure Synapse with input and output Params</title>
      <link>https://community.databricks.com/t5/data-engineering/call-a-stored-procedure-in-azure-synapse-with-input-and-output/m-p/4452#M1181</link>
      <description>&lt;P&gt;Can you provide more details on the output? I am not entirely sure if the print statement would show the value of rs as it may just show the type of the python object since it is not a string variable. &lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 16:48:48 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/call-a-stored-procedure-in-azure-synapse-with-input-and-output/m-p/4452#M1181</guid>
      <dc:creator>Ryan_Chynoweth</dc:creator>
      <dc:date>2023-06-09T16:48:48Z</dc:date>
    </item>
    <item>
      <title>Re: Call a Stored Procedure in Azure Synapse with input and output Params</title>
      <link>https://community.databricks.com/t5/data-engineering/call-a-stored-procedure-in-azure-synapse-with-input-and-output/m-p/50415#M28802</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;statement=&lt;/SPAN&gt;&lt;SPAN&gt;"EXEC procedurename&amp;nbsp; imputparametre , ? "&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;driver_manager = spark._sc._gateway.jvm.java.sql.DriverManager&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;con = driver_manager.getConnection(jdbcUrl, username, pwd)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;exec_statement = con.prepareCall(statement)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;exec_statement.registerOutParameter(&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;, spark._sc._gateway.jvm.java.sql.Types.VARCHAR)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;df=exec_statement.execute()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;# Close connections&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;result=exec_statement.getString(&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;display(result)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;exec_statement.close()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;con.close()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 03 Nov 2023 11:59:30 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/call-a-stored-procedure-in-azure-synapse-with-input-and-output/m-p/50415#M28802</guid>
      <dc:creator>sivaram_bh</dc:creator>
      <dc:date>2023-11-03T11:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: Call a Stored Procedure in Azure Synapse with input and output Params</title>
      <link>https://community.databricks.com/t5/data-engineering/call-a-stored-procedure-in-azure-synapse-with-input-and-output/m-p/71092#M34242</link>
      <description>&lt;P&gt;This blog helped me with the output of the stored procedure: &lt;A href="https://medium.com/@judy3.yang/how-to-run-sql-procedure-in-databricks-notebook-e28023555565" target="_blank"&gt;https://medium.com/@judy3.yang/how-to-run-sql-procedure-in-databricks-notebook-e28023555565&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2024 08:19:42 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/call-a-stored-procedure-in-azure-synapse-with-input-and-output/m-p/71092#M34242</guid>
      <dc:creator>judyy</dc:creator>
      <dc:date>2024-05-30T08:19:42Z</dc:date>
    </item>
  </channel>
</rss>

