Options

Parameterised Queries using ADO.NET throw exception unless non-parameterised query is run successful

I've created a gist with example code here: https://gist.github.com/NeilRobbins/10024191

We have replicated this using the 6.1.2 and 6.1.3 Vertica.Data dll.
Our cluster is running 6.1.3

The behaviour that we are seeing is that if we execute parameterised commands we get the following exception:
System.NullReferenceException was unhandled  HResult=-2147467261
  Message=Object reference not set to an instance of an object.
  Source=Vertica.Data
  StackTrace:
       at Vertica.Data.Internal.ADO.Net.SParameter.SetupNewTypeMetadata(Int32 newProviderType, Boolean isSigned, Boolean throwOnFailure)
       at Vertica.Data.Internal.ADO.Net.SParameter.set_DbType(DbType value)
       at Vertica.Data.VerticaClient.VerticaParameter.set_Type(VerticaType value)
       at Vertica.Data.VerticaClient.VerticaParameter..ctor(String name, VerticaType type, Object value)
       at Vertica.Data.VerticaClient.VerticaParameter..ctor(String name, VerticaType type)
       at VerticaPlay.SimpleQuery.Run(String connectionString) in c:\git\spikes\VerticaPlay\VerticaPlay\Program.cs:line 32
       at VerticaPlay.Program.Main(String[] args) in c:\git\spikes\VerticaPlay\VerticaPlay\Program.cs:line 15
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 
Unless...

We execute a command first which is not parameterised (both select statements and Set Search_Path work for this).

Is this a known issue with the 6.1.3 Vertica.Data.dll?
Is there something we can do in terms of settings to fix this?

Help appreciated!

Neil


Comments

  • Options
    Cross-posting the solution from the other thread...

    This was an issue in the 6.x driver: "attempts to create a parameter before the first connection attempt in an ADO.NET application throws a NullReferenceException." The issue is resolved in the 7.x driver.

    The workaround for 6.x, as you have discovered, is to call Open() on the connection before creating any parameters. 
  • Options
    Having updated to 7 we still get this issue. I have put a gist up that reproduces the issue, details the exception, etc...

    https://gist.github.com/NeilRobbins/11396515

    (will cross-post to other thread also)

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file