Skip to content

Instantly share code, notes, and snippets.

@kevinhillinger
Created April 10, 2014 15:05
Show Gist options
  • Save kevinhillinger/10391868 to your computer and use it in GitHub Desktop.
Save kevinhillinger/10391868 to your computer and use it in GitHub Desktop.
Try to open sql connections against sqlfire
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Dapper;
using VMware.Data.SQLFire;
namespace sqlfire._112
{
class Program
{
const string connString = "Server=localhost:1527;user=appuser;password=swys;Minimum Pool Size={0}; Maximum Pool Size=100";
static void Main(string[] args)
{
const int minPoolSize = 0;
const int minConnectionCount = 50; //anything above 20 connections. starts to throw.
Func<int, IDbConnection> connFactory = (index) =>
{
var conn = new SQLFClientConnection(string.Format(connString, minPoolSize));
Console.WriteLine("Connection " + index + " created.");
return conn;
};
foreach (var index in Enumerable.Range(1, 2))
{
var connections = Enumerable.Range(1, minConnectionCount).Select(j =>
{
var conn = connFactory(j);
try
{
conn.Open();
}
catch
{
Console.WriteLine("Error creation connection {0} of iteration {1}", j, index);
throw;
}
return conn;
});
//attempt to execute the connections
foreach (var conn in connections)
{
conn.Execute("SELECT 1 FROM SYSIBM.SYSDUMMY1;");
// Console.WriteLine("Used Connection State: " + conn.State);
}
}
Console.WriteLine("Test complete. Please press Enter to end");
Console.ReadLine();
}
}
}
@kevinhillinger
Copy link
Author

SQLState(08003) Severity(Session) getConnection() is not valid on a closed PooledConnection.

@kevinhillinger
Copy link
Author

at VMware.Data.SQLFire.SQLFClientConnection.Open(Dictionary2 properties) in u:\sqlfire112X_maint\sqlfire\csharp\ado-ikvm\SQLFClientConnection.cs:line 191 at VMware.Data.SQLFire.SQLFConnection.Open() in u:\sqlfire112X_maint\sqlfire\csharp\ado-ikvm\SQLFConnection.cs:line 226 at sqlfire._112.Program.<>c__DisplayClass6.<Main>b__1(Int32 j) in c:\Projects\sqlfire.perf\src\sqlfire.112\Program.cs:line 41 at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()
at sqlfire._112.Program.Main(String[] args) in c:\Projects\sqlfire.perf\src\sqlfire.112\Program.cs:line 47
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()

@kevinhillinger
Copy link
Author

Also getting:

SQLState(08006) Severity(Session) An error occurred during connect reset and the connection has been terminated. See chained exceptions for details.

Inner Exception:
SQLState(XJ001) Severity(NoneApplicable) DisconnectException 08006: An error occurred during connect reset and the connection has been terminated. See chained exceptions for details.

Stack Trace:
at com.vmware.sqlfire.internal.client.am.Connection.reset(Connection.java:2557)
at com.vmware.sqlfire.internal.client.ClientPooledConnection.getConnection(ClientPooledConnection.java:262)
... 9 more
(SQLExceptionFactory40.java:77)
at com.vmware.sqlfire.internal.client.am.SqlException.getSQLException(SqlException.java:401)
at com.vmware.sqlfire.internal.client.ClientPooledConnection.getConnection(ClientPooledConnection.java:276)
at cli.VMware.Data.SQLFire.Driver.GetConnection(SQLFConnectionPool.cs:396)
at cli.VMware.Data.SQLFire.SQLFClientConnection.Open(SQLFClientConnection.cs:185)
at cli.VMware.Data.SQLFire.SQLFConnection.Open(SQLFConnection.cs:227)
at cli.sqlfire._112.Program$$$003C$$003Ec__DisplayClass6.

b__1(Program.cs:36)
at cli.System.Linq.Enumerable$WhereSelectEnumerableIterator$$00602.MoveNext(Unknown Source)
at cli.sqlfire._112.Program.Main(Program.cs:47)
at cli.System.AppDomain._nExecuteAssembly(Unknown Source)
at cli.System.AppDomain.ExecuteAssembly(Unknown Source)
at cli.Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly(Unknown Source)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment