Forum Discussion
How can I use Excel from SQL Server 2019 with PolyBase?
- Nov 04, 2018
Okey.
I am use CDATA EXCEL ODBC Driver x64..Fixed it.
https://www.cdata.com/drivers/excel/download/odbc/
Uninstall Microsoft Access Database Engine 2016 Redistributable..
Install CDATA EXCEL ODBC Driver Version: 18.0.6817.
Thanks!
Microsoft.SqlServer.DataWarehouse.DataMovement.Common.ExternalAccess.OdbcUtil.GetTableType()
ok. I look this dll code.
public static void GetTableType(string connectionString, int connectionLoginTimeout, string catalogNameArgument, string schemaNameArgument, string tableNameArgument, out List<string> fieldNameList, out short[] dataTypeArray, out int[] columnSizeArray, out int[] bufferLengthArray, out short[] decimalDigitsArray, out short[] nullableArray, out int[] ordinalPositionArray, out List<string> typeNameList)
{
//IL_0151: Expected O, but got Unknown
if (connectionString == null)
{
throw new ArgumentNullException("connectionString");
}
NativeOdbcConnection nativeOdbcConnection = new NativeOdbcConnection(connectionString, CreateOptionFlags.ReadExternal, string.Empty);
nativeOdbcConnection.ConnectionLoginTimeout = connectionLoginTimeout;
nativeOdbcConnection.EnableConnectionPooling = true;
using (NativeOdbcConnection nativeOdbcConnection2 = nativeOdbcConnection)
{
IntPtr fieldNames = IntPtr.Zero;
IntPtr dataType = IntPtr.Zero;
IntPtr columnSize = IntPtr.Zero;
IntPtr bufferLength = IntPtr.Zero;
IntPtr decimalDigits = IntPtr.Zero;
IntPtr nullable = IntPtr.Zero;
IntPtr ordinalPosition = IntPtr.Zero;
IntPtr typeNames = IntPtr.Zero;
int numFields = 0;
try
{
nativeOdbcConnection2.Open();
if (!DmsNative.OdbcGetTableType(nativeOdbcConnection2.OdbcConnHandle, catalogNameArgument, schemaNameArgument, tableNameArgument, out fieldNames, out dataType, out columnSize, out bufferLength, out decimalDigits, out nullable, out ordinalPosition, out typeNames, out numFields))
{
ThrowMppSqlException("OdbcUtil.GetTableType, error in OdbcGetTableType", nativeOdbcConnection2);
}
fieldNameList = MarshalIntPtrToStringList(fieldNames, numFields);
dataTypeArray = new short[numFields];
Marshal.Copy(dataType, dataTypeArray, 0, numFields);
columnSizeArray = new int[numFields];
Marshal.Copy(columnSize, columnSizeArray, 0, numFields);
bufferLengthArray = new int[numFields];
Marshal.Copy(bufferLength, bufferLengthArray, 0, numFields);
decimalDigitsArray = new short[numFields];
Marshal.Copy(decimalDigits, decimalDigitsArray, 0, numFields);
nullableArray = new short[numFields];
Marshal.Copy(nullable, nullableArray, 0, numFields);
ordinalPositionArray = new int[numFields];
Marshal.Copy(ordinalPosition, ordinalPositionArray, 0, numFields);
typeNameList = MarshalIntPtrToStringList(typeNames, numFields);
if (numFields == 0)
{
ErrorUtil.GenerateUserVisibleException(SR.TableDoesNotExist(tableNameArgument));
}
}
catch (DmsSqlNativeException val)
{
DmsSqlNativeException ex = val;
throw GenerateUserVisibleException(ex);
}
finally
{
FreeIntPtrArray(fieldNames, numFields);
Marshal.FreeCoTaskMem(dataType);
Marshal.FreeCoTaskMem(columnSize);
Marshal.FreeCoTaskMem(bufferLength);
Marshal.FreeCoTaskMem(decimalDigits);
Marshal.FreeCoTaskMem(nullable);
Marshal.FreeCoTaskMem(ordinalPosition);
FreeIntPtrArray(typeNames, numFields);
nativeOdbcConnection2.Close();
}
}
}
if (!DmsNative.OdbcGetTableType(nativeOdbcConnection2.OdbcConnHandle, catalogNameArgument, schemaNameArgument, tableNameArgument, out fieldNames, out dataType, out columnSize, out bufferLength, out decimalDigits, out nullable, out ordinalPosition, out typeNames, out numFields))
{
ThrowMppSqlException("OdbcUtil.GetTableType, error in OdbcGetTableType", nativeOdbcConnection2);
}
The place where the error occurred is here.↑
ThrowMppSqlException()
SQL Server 2019 CTP2.0 is not support Excel ODBC x64?