<?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: Stored Procedure execution using JDBC is trimming the CHAR, VARCHAR and VARBINARY data in Data Warehouse</title>
    <link>https://community.fabric.microsoft.com/t5/Data-Warehouse/Stored-Procedure-execution-using-JDBC-is-trimming-the-CHAR/m-p/4393783#M2452</link>
    <description>&lt;P&gt;this worked, thanks.&lt;/P&gt;&lt;P&gt;But what is the impact of this, because we use Fabric Warehouse tables and stored procedures, there will be tables which contains Unicode characters in column names and data will also can have unicode chars.&lt;/P&gt;</description>
    <pubDate>Tue, 04 Feb 2025 08:05:20 GMT</pubDate>
    <dc:creator>amokhalgay</dc:creator>
    <dc:date>2025-02-04T08:05:20Z</dc:date>
    <item>
      <title>Stored Procedure execution using JDBC is trimming the CHAR, VARCHAR and VARBINARY data</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Warehouse/Stored-Procedure-execution-using-JDBC-is-trimming-the-CHAR/m-p/4392255#M2446</link>
      <description>&lt;P&gt;I am executing stored procedure using JDBC driver.&amp;nbsp; So when I have an output field of type CHAR, VARCHAR or VARBINARY with precision 8000. After executing the SP using JDBC API, it returns only 4000 Chars. Need to know if there is anything I missed in execution. The query is simple&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;EXEC SCHEMA_NAME.STORED_PROC_NAME&amp;nbsp;@c_varchar = ?,&amp;nbsp;@c_varchar2=?&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;In above example c_varchar is input field and c_varchar2 is in/out type field. c_varchar2 has 8000 precision set still the output which i get is 4000 length even though the procedure is designed to return 8000 characters. Please help me rectify this issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Below is the code snippet:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;CallableStatement callStmt = sqlConnection.prepareCall("EXEC dbo.proc_name @c_varchar =? , @c_varchar2= ?" );&lt;BR /&gt;callStmt.setString(1, "2345");&lt;BR /&gt;callStmt.setNull(2, Types.VARCHAR);&lt;BR /&gt;callStmt.registerOutParameter(2, Types.VARCHAR);&lt;/P&gt;&lt;P&gt;callStmt.execute();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Procedure design :&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;CREATE PROC dbo.proc_name&lt;/P&gt;&lt;P&gt;@c_varchar varchar(8000),&lt;BR /&gt;@c_varchar2 varchar(8000) OUT&lt;/P&gt;&lt;P&gt;AS&lt;BR /&gt;BEGIN&lt;BR /&gt;SELECT&lt;/P&gt;&lt;P&gt;@c_varchar2= c_varchar2&lt;/P&gt;&lt;P&gt;FROM dbo.char_SP&lt;BR /&gt;WHERE c_varchar = @c_varchar;&lt;BR /&gt;END;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2025 10:26:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Warehouse/Stored-Procedure-execution-using-JDBC-is-trimming-the-CHAR/m-p/4392255#M2446</guid>
      <dc:creator>amokhalgay</dc:creator>
      <dc:date>2025-02-03T10:26:05Z</dc:date>
    </item>
    <item>
      <title>Re: Stored Procedure execution using JDBC is trimming the CHAR, VARCHAR and VARBINARY data</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Warehouse/Stored-Procedure-execution-using-JDBC-is-trimming-the-CHAR/m-p/4392940#M2448</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="923421" data-lia-user-login="amokhalgay" class="lia-mention lia-mention-user"&gt;amokhalgay&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Problem seems to be with&amp;nbsp;JDBC drivers may treat `VARCHAR` parameters as Unicode (`NVARCHAR`) by default, causing truncation at 4000 characters (since `NVARCHAR(4000)` uses 8000 bytes).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;before we jump to solution , please share how are you using jdbc driver in your case&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2025 17:19:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Warehouse/Stored-Procedure-execution-using-JDBC-is-trimming-the-CHAR/m-p/4392940#M2448</guid>
      <dc:creator>nilendraFabric</dc:creator>
      <dc:date>2025-02-03T17:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: Stored Procedure execution using JDBC is trimming the CHAR, VARCHAR and VARBINARY data</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Warehouse/Stored-Procedure-execution-using-JDBC-is-trimming-the-CHAR/m-p/4393597#M2450</link>
      <description>&lt;P&gt;&lt;STRONG&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="913195" data-lia-user-login="nilendraFabric" class="lia-mention lia-mention-user"&gt;nilendraFabric&lt;/a&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;This is the code I did to get sql connection from driver:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Driver version is :&amp;nbsp;&lt;STRONG&gt;mssql-jdbc-12.2.0.jre8.jar&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");&lt;BR /&gt;Connection sqlConnection = DriverManager.getConnection(prepareJDBCUrl(jdbcConnectString, databaseName), info);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;public static String prepareJDBCUrl(String jdbcConnectionString, String databaseName) {&lt;BR /&gt;StringBuilder sb = new StringBuilder();&lt;BR /&gt;return sb.append("jdbc:sqlserver://")&lt;BR /&gt;.append(jdbcConnectionString)&lt;BR /&gt;.append(":1433;database=")&lt;BR /&gt;.append(databaseName)&lt;BR /&gt;.append(";encrypt=true;authentication=")&lt;BR /&gt;.append("ActiveDirectoryServicePrincipal")&lt;BR /&gt;.toString();&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2025 06:39:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Warehouse/Stored-Procedure-execution-using-JDBC-is-trimming-the-CHAR/m-p/4393597#M2450</guid>
      <dc:creator>amokhalgay</dc:creator>
      <dc:date>2025-02-04T06:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: Stored Procedure execution using JDBC is trimming the CHAR, VARCHAR and VARBINARY data</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Warehouse/Stored-Procedure-execution-using-JDBC-is-trimming-the-CHAR/m-p/4393699#M2451</link>
      <description>&lt;P&gt;Try adding&lt;/P&gt;&lt;P&gt;`sendStringParametersAsUnicode=false` to your JDBC connection string.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This ensures parameters are sent as `VARCHAR` instead of `NVARCHAR`&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2025 07:27:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Warehouse/Stored-Procedure-execution-using-JDBC-is-trimming-the-CHAR/m-p/4393699#M2451</guid>
      <dc:creator>nilendraFabric</dc:creator>
      <dc:date>2025-02-04T07:27:21Z</dc:date>
    </item>
    <item>
      <title>Re: Stored Procedure execution using JDBC is trimming the CHAR, VARCHAR and VARBINARY data</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Warehouse/Stored-Procedure-execution-using-JDBC-is-trimming-the-CHAR/m-p/4393783#M2452</link>
      <description>&lt;P&gt;this worked, thanks.&lt;/P&gt;&lt;P&gt;But what is the impact of this, because we use Fabric Warehouse tables and stored procedures, there will be tables which contains Unicode characters in column names and data will also can have unicode chars.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2025 08:05:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Warehouse/Stored-Procedure-execution-using-JDBC-is-trimming-the-CHAR/m-p/4393783#M2452</guid>
      <dc:creator>amokhalgay</dc:creator>
      <dc:date>2025-02-04T08:05:20Z</dc:date>
    </item>
    <item>
      <title>Re: Stored Procedure execution using JDBC is trimming the CHAR, VARCHAR and VARBINARY data</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Warehouse/Stored-Procedure-execution-using-JDBC-is-trimming-the-CHAR/m-p/4393812#M2453</link>
      <description>&lt;P&gt;Great it worked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you should ensure that, for any operations involving Unicode content, you either continue using the corresponding Unicode-specific JDBC methods (e.g., setNString) or otherwise verify that the default code page conversion does not corrupt data.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Easiest way is to verify unicode data manually in WH and see i&lt;/P&gt;&lt;P&gt;the impact.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please accept this answer if this is helpful&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2025 08:16:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Warehouse/Stored-Procedure-execution-using-JDBC-is-trimming-the-CHAR/m-p/4393812#M2453</guid>
      <dc:creator>nilendraFabric</dc:creator>
      <dc:date>2025-02-04T08:16:51Z</dc:date>
    </item>
  </channel>
</rss>

