You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just play around with sqltoolservice and I did a quick sample using Microsoft StreamJsonRpc as client.
using StreamJsonRpc;
using StreamJsonRpcSample.ConnectionManagementModel;
using StreamJsonRpcSample.Utility;
using System.Diagnostics;
Process? childProcess = Process.Start(new ProcessStartInfo("C:\\Microsoft.SqlTools.ServiceLayer-win-x64-net7.0\\MicrosoftSqlToolsServiceLayer.exe")
{
RedirectStandardInput = true,
RedirectStandardOutput = true,
}) ?? throw new Exception("childProcess cannot be null.");
JsonRpc jsonRpc = JsonRpc.Attach(childProcess.StandardInput.BaseStream, childProcess.StandardOutput.BaseStream);
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
{
var uri = new Uri(queryTempFile.FilePath);
var ownerURI = uri.AbsoluteUri;
ConnectParams connectParams = new ConnectParams
{
OwnerUri = ownerURI,
Connection = new ConnectionDetails
{
DataBaseName = myDatabase",
Password = "myPassword",
ServerName = "localhost",
UserName = "sa"
}
};
bool response = await jsonRpc.InvokeWithParameterObjectAsync<bool>("connection/connect", connectParams);
if (response)
{
Console.WriteLine("Connected!!!");
ListDatabasesParams listDatabasesParams = new ListDatabasesParams
{
OwnerUri = ownerURI,
IncludeDetails = true
};
ListDatabasesResponse res = await jsonRpc.InvokeWithParameterObjectAsync<ListDatabasesResponse>("connection/listdatabases", listDatabasesParams);
foreach (var item in res.DatabaseNames)
{
Console.WriteLine(item);
}
}
else
{
Console.WriteLine("NO Connected!!!");
}
}
I got the following error:
StreamJsonRpc.RemoteInvocationException
HResult=0x80131500
Message=System.Exception: SpecifiedUri 'file:///C:/Users/xxx/AppData/Local/Temp/tmp3pbks3.tmp' does not have existing connection
at Microsoft.SqlTools.ServiceLayer.Connection.ConnectionService.ListDatabases(ListDatabasesParams listDatabasesParams) in //src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionService.cs:line 1092
at Microsoft.SqlTools.ServiceLayer.Connection.ConnectionService.<>c__DisplayClass95_0.<b__0>d.MoveNext() in //src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionService.cs:line 1342
Source=StreamJsonRpc
StackTrace:
at StreamJsonRpc.JsonRpc.d__151`1.MoveNext()
at Program.<
$>d__0.MoveNext() in C:\Users\xxx\source\repos\StreamJsonRpcSample\StreamJsonRpcSample\Program.cs:line 43
Hello Guys,
I just play around with sqltoolservice and I did a quick sample using Microsoft StreamJsonRpc as client.
I got the following error:
StreamJsonRpc.RemoteInvocationException
$>d__0.MoveNext() in C:\Users\xxx\source\repos\StreamJsonRpcSample\StreamJsonRpcSample\Program.cs:line 43HResult=0x80131500
Message=System.Exception: SpecifiedUri 'file:///C:/Users/xxx/AppData/Local/Temp/tmp3pbks3.tmp' does not have existing connection
at Microsoft.SqlTools.ServiceLayer.Connection.ConnectionService.ListDatabases(ListDatabasesParams listDatabasesParams) in //src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionService.cs:line 1092
at Microsoft.SqlTools.ServiceLayer.Connection.ConnectionService.<>c__DisplayClass95_0.<b__0>d.MoveNext() in //src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionService.cs:line 1342
Source=StreamJsonRpc
StackTrace:
at StreamJsonRpc.JsonRpc.d__151`1.MoveNext()
at Program.<
Versions:
StreamJsonRpc - 2.17.11
sqltoolsservice - 4.12.07
net8.0
The text was updated successfully, but these errors were encountered: