Persistent Communication Session Inside Sqlclr Proc?

Jul 21, 2006

I suspect this is very poor design but I've been asked to research this: can I maintain a persistent communication session inside an sqlclr proc? (tcp/binary packets)

The process has to maintain very high throughput - setting up and tearing down a connection on each transaction is cost prohibitive. For TCO and deployment reasons it is preferable not to have a separate windows service etc that accepts requests from inside the clr proc. Is there the luxury of an alternative integrated into the database?

View 4 Replies


ADVERTISEMENT

Caching Inside SQLCLR

Jan 31, 2006

Hi,



My .NET SQL UDF needs do very complex computation on every call regardless on user input. I would be very happy if I could cache this computed data somewhere in SQL Server memory. And then I should not need to recompute this complex information on every UDF call. Is it possible to cache something inside SQL Server from CLR ?



Thanks.

View 1 Replies View Related

Cannot Use Anonymous Methods Inside SQLCLR...

Sep 15, 2006

Hi all,

The problem is: when you're trying to call in method MyMethod anonymous method that doesn't use local variables, deployment of the assembly will fail referring that MyMethod tries to store smth. in the static variable. Indeed, looking at the compiled CLR code, you can see that anonymous delegate is cached in the private static delegate and the call looks like:

If(ClassName.privateStaticDelegate == null)
ClassName.privateStaticDelegate = new MyDelegate(HiddenMethodName);
CallAnonymousMethod(ClassName.privateStaticDelegate);

Is there any workaround to fix this problem.

P.S. I googled about this problem and found only one article on it:
http://www.ayende.com/Blog/default,date,2005-12-26.aspx

View 4 Replies View Related

New Session Inside SP?

Sep 16, 2004

Hi:

I want to open a new session/connection inside the execution of a stored procedure. Is this possible ?
I ask this because I need a new sesssion with its own transaction.

Thanks,
Rui Ferreira

View 6 Replies View Related

T-SQL (SS2K8) :: Proc Giving Error In One Session And Runs In Another

Nov 13, 2014

I have one drop and create procedure script in one sql session and execute the procedure in other session. Now when i am compiling the procedure in first session, it gets completed successfully.

Now when i move to other session and try to execute the procedure, it gives me error saying :

"Invalid column name 'ColumnName'."

Now when I execute the procedure in same session in which procedure was compiled, it runs successfully. Once run, I go back to my other session and it runs again.

View 9 Replies View Related

Static Variables In A SQLCLR Stored Proc Seem To Get Reused From Execution To Execution Of The Sp

Aug 23, 2007

after moving off VS debugger and into management studio to exercise our SQLCLR sp, we notice that the 2nd execution gets an error suggesting that our static SqlCommand object is getting reused from the 1st execution (of the sp under mgt studio). If this is expected behavior, we have no problem limiting our statics to only completely reusable objects but would first like to know if this is expected? Is the fact that debugger doesnt show this behavior also expected?

View 4 Replies View Related

Using VDI Inside Of CLR Stored Proc

May 25, 2007

Q: how to use VDI from SQL2k5 inside of CLR stored proc writen in C#?



In SQL2K i've wrote C++ extended stored proc using headers from VDI SDK.



any simple samples for C# and CLR exists?



thanks.







View 3 Replies View Related

Oracle From Inside A SQL Server Proc

Feb 10, 2000

I'm having a problem getting one of my procs (on SQL Server) to talk to an Oracle DB. I've used sp_addlinkedserver and sp_addlinkedsrvlogin,
but I'm getting an error that indicates that I'm not using the right naming convention.

If the NT server is name NTBOX, and the Oracle instance is YLO, with a valid user ME with password ITS, and the database (in SQL terms) is ABC
and the table is MyTable, I would think that

sp_addlinkedserver @server = 'NTBOX', @srvproduct = 'oracle', @provider = 'MSDAORA', @datasrc = 'YLO'

sp_addlinkedsrvlogin 'NTBOX', 'false', NULL, 'host', 'oracle'

select * from NTBOX.YLO..MyTable

would work. I'm getting "OLE/DB provider returned message: ORA-12154: TNS:could not resolve service name".

View 2 Replies View Related

SQL Server 2012 :: Run DBCC Inside Stored Proc Using EXECUTE AS

Mar 18, 2014

I am a SysAdmin on a test/dev SQL instance. Other non-sysadmin users (developers) need the ability to execute DBCC commands like the following:

DBCC FREESYSTEMCACHE ('ALL') WITH MARK_IN_USE_FOR_REMOVAL
OR
DBCC FREEPROCCACHE

I tried creating a store proc in a user database and granting those non-sysadmin users EXECUTE permission on it as so:

CREATE PROC spFreeSystemCache
WITH EXECUTE AS 'sa'
AS
DBCC FREESYSTEMCACHE ('ALL') WITH MARK_IN_USE_FOR_REMOVAL
GO

When I try to create this proc, I get the following error:

Msg 102, Level 15, State 1, Procedure spFreeSystemCache, Line 2
Incorrect syntax near 'sa'.

Ok, so I can't EXECUTE AS sa...

View 5 Replies View Related

Not Able To Create Hash Table Inside Stored Proc Through Execute Sp_executesql @strQuery

Aug 21, 2007

Hello,
i need to create temporary table inside SP.
i having one string variable @strQuery which contain dynamic query inside SP.
i am executing that trhough execute sp_executesql @strQuery once query build.

now instead of select query , i want to creat hash table.
so i wrote :

set @strQuery = "Select * into #tmp_tbl from table_name..."
when i tried to execute it through

execute sp_executesql @strQuery , its giving error 'Invalid object name '#tmp_tbl'
If i removed Hash then it works fine. even for double Hash also its work fine.
but i want hash table only as i want that table local to that user.

Even direct execution of select statement without @strQuery works fine. but i want to execute @strQuery through execute sp_executesql @strQuery only as query is dynamic .


please guide me how to do this?
its very urgent for me.
thanks in advance.

View 4 Replies View Related

SSE And Deleting Persistent Connections From ASP.NET

May 4, 2008

I'm a new user that is playiing with a few of the MS web tools available. I have been trying out the ClubDB sample as part of looking at visual web express. I have installed the sample and ran it in multiple directories while debugging. Most of the directories have now been delected. My problem now is that I cannot add back ClubDB and access it remotely because somewhere in the SQL database there are connections made for each of the previous "test" runs of the sample. I have run SSEUtil and deleted all connections involved (no clubdb or aspnetdb connections still connected) but that doesn't seem to fix it. For example, there still seems to be a table somewhere that remembers that I once had a "clubdb" connection in websitemainapp_data.

My questions are:
- where is this information stored?
- is there an easy to use tool to clear all of these persistant connections.

thanks

View 6 Replies View Related

Definition Of 'Persistent Data'

Nov 4, 2006

What is the definition of 'Persistent Data' as related to the definition of a RDBMS?

thx,

Kat

View 4 Replies View Related

Persistent Autoincrementing Value, Not Attached To Row Insertion?

Oct 19, 2004

I need to get a unique value to use for a record *before* the record is added to a table. It doesn't have to be contiguous with existing records, but it must always be unique, has to be persistent over multiple instantiations of an ASP.NET application, and has to work in that sort of a multi-session environment (where other sessions could need additional unique values before the first session gets around to actually adding a record to the table).

I considered generating and using unique CLSIDs for this, but the resulting value also needs to become part of the filename of some files that are being saved to the disk (and those names also saved in the table), and including text CLSIDs along with other filename data would make for some unpleasantly long and difficult to work with filenames.

I also don't think there's a practical way for me to use a trigger associated with an identity column for this, because I need to save files to disk using the unique value before I even know if the record will in fact end up being added to the table, and what's more, the numbers and names of those files will vary in ways that might be difficult to handle in a stored procedure.

What I'm thinking I will have to do is create a separate database table called something like "UniqueIDGen". This table would have a single record in it with a single integer value, initialized to a value of 1. Then, each time an ID is needed, this one record would be locked, read and incremented by 1. The only reason for doing it this way instead of with an application variable, as I see it, is that the values need to be unique and continue incrementing in perpetuity, no matter how many times the ASP.NET application is recycled or the server is rebooted.

But I still have to wonder if there might be a more efficient method provided by SQL Server for this type of unique value generation ... something that is equally as persistent without requiring an entire table with only a single record to be allocated to such a basic task. Does anyone know of a more elegant solution for this?

View 6 Replies View Related

Maintaing A Connection Across Pages (Persistent)

Nov 8, 2005

I've only been workign with Database programming for 6 months or so, specfically SQL Server. I've setup a site through a hosting company that is pretty reputable and allows me plent of space/bandwidth etc. However, they've recently been having problems with one of their servers (the one I'm co hosted on) as an "abornamlly" large amount of connections are being opened up on their server.

I realize that SQL Server is designed to handle large amounts of traffic and my humble little site probably isn't killing it with shear traffic, but I'm wondering if my programming practicies are sub par and causing problems.

I'm coding in ASP (work hasn't given us the chance to migrate to .net). Anyway my site is getting some 30 - 40k hits a day on the actual web portion and probably another 10-20k on backed stuff - all which open up database connections to do their work.

I've had locks and blocks routinely because of this and I'm afraid I'm just going about this all wrong.

So I'm wondering if there is a way to maintain an established connection in ASP across multiple pages and/or sessions so I don't have to constantly drop and reconnect to the db?

Any help would be great!

View 1 Replies View Related

Persistent SQLBrowser Error EventID 3

Jul 25, 2006

I have what looks like a completed install of SQL Server Express Edition, accomplished via unattended setup as part of a custom application (on a machine hereafter dubbed Machine "A").

So far, though, I can't access this instance from a remote SQL Server Management Studio because SSMSE can't see the installed database engine.

I've verified that:

The SQL Server Express installation on Machine A has remote connections enabled.
The SQLBrowser on Machine A is enabled and running.
Machine A's Windows Firewall is disabled.
Using a test tool, I can see that UDP messages sent to SQLBrowser (on port 1434), arrive (i.e. it complains about their format in the System Log).

It seems that Machine A's SQLBrowser isn't responding to requests, but there's no obvious reason why.

There's one clue in Machine A's event log:

Whenever SQLBrowser is started or restarted, there's a warning in the App Log:

"The configuration of the AdminConnectionTCP protocol in the SQL instance SQLEXPRESS is not valid." (eventid 3).

Any help will be much appreciated.

Thanks in advance
Josh

View 1 Replies View Related

SQL Server Session State - Using A 1.1 Database Schema For 2.0 Session State Storage

Aug 3, 2006

The 2.0 version of ASPSTATE is slightly different than the 1.1 version in that one table has one additional column and another table uses a different data type and size for the key. The 2.0 version also has a couple additional stored procedures.

We'd like to manage just one session state database if possible so we're trying to figure out if Microsoft supports using the new schema for 1.1 session state access (it seems to work, but our testing has been very light).

Is there any official support line on this? If not, can anyone comment on whether or not you'd expect it to work and why?

Thanks.

View 1 Replies View Related

How Do You Determine The Active Node Inside A Stored Proc For An Active/passive 2-node Cluster?

Jan 16, 2008

I invoke xp_cmdshell proc from inside a stored procedure on a 2-node active/passive SQL 2005 SP2 Standard cluster. Depending on which server the xp_cmdshell gets executed on I need to pass different arguments in the shell command. I thought I could use host_name() function to get the runtime process server, however, I am finding that it's not behaving correctly. In one example I know my active node is server2, but the host_name() function is returning server1. The only thing that I could possible explain this is that the MSDTC cluster group is not always on the same active node as the SQL server group and in the case I am talking about the cluster groups are in this mode (differnet nodes). Does the xp_cmdshell get executed by the SQL active node or the MDTC active node? And what is the best way to find out which server is going to run my xp_cmdshell?

Thanks.

Edit:

Perhaps another by product of this is that if I run select host_name() from the Studio Management query window i get different results depending on which server I am running the Studio Management on. On server1 I get server1 and on server 2 I get server 2, all the while server2 is the active node. I need a different function that will always let me determine the correct server that'll be running the xp_cmdshell...

Edit 2: I guess I could determine the running host inside the command shell itself, but I am curious to see if i can do it (cleaner) from SQL.

View 1 Replies View Related

Do GetDate() Inside SQL Server OR Do System.DateTime.Now Inside Application ?

Sep 12, 2007

For inserting current date and time into the database, is it more efficient and performant and faster to do getDate() inside SQL Server and insert the value
OR
to do System.DateTime.Now in the application and then insert it in the table?
I figure even small differences would be magnified if there is moderate traffic, so every little bit helps.
Thanks.

View 9 Replies View Related

EXEC Inside CASE Inside SELECT

Nov 16, 2007

I'm trying to execute a stored procedure within the case clause of select statement.
The stored procedure returns a table, and is pretty big and complex, and I don't particularly want to copy the whole thing over to work here. I'm looking for something more elegant.

@val1 and @val2 are passed in


CREATE TABLE #TEMP(
tempid INT IDENTITY (1,1) NOT NULL,
myint INT NOT NULL,
mybool BIT NOT NULL
)

INSERT INTO #TEMP (myint, mybool)
SELECT my_int_from_tbl,
CASE WHEN @val1 IN (SELECT val1 FROM (EXEC dbo.my_stored_procedure my_int_from_tbl, my_param)) THEN 1 ELSE 0
FROM dbo.tbl
WHERE tbl.val2 = @val2


SELECT COUNT(*) FROM #TEMP WHERE mybool = 1


If I have to, I can do a while loop and populate another temp table for every "my_int_from_tbl," but I don't really know the syntax for that.

Any suggestions?

View 8 Replies View Related

Differentiate Between Whether Stored Procedure A Is Executed Inside Query Analyzer Or Executed Inside System Application Itself.

May 26, 2008

Just wonder whether is there any indicator or system parameters that can indicate whether stored procedure A is executed inside query analyzer or executed inside application itself so that if execution is done inside query analyzer then i can block it from being executed/retrieve sensitive data from it?

What i'm want to do is to block someone executing stored procedure using query analyzer and retrieve its sensitive results.
Stored procedure A has been granted execution for public user but inside application, it will prompt access denied message if particular user has no rights to use system although knew public user name and password. Because there is second layer of user validation inside system application.

However inside query analyzer, there is no way control execution of stored procedure A it as user knew the public user name and password.

Looking forward for replies from expert here. Thanks in advance.

Note: Hope my explaination here clearly describe my current problems.

View 4 Replies View Related

Asp - Vb6 Communication

Feb 28, 2004

Hi,
I have created vb6 app to connect to sql server 2000 db, and now i have a new requirement: to publish this app on web, but I should use an exising vb6 application that includes all buisness logic and all communication with database: quieries, stored procedures, etc.
To implement this, i create a client :HTML interface and server: asp file that receives an input from client and calls vb6 functions with parameters he received from client. My question is: how can i call from asp application a vb6 application?

View 1 Replies View Related

SQLCLR 32-bit Vs 64-bit

Aug 9, 2006

Is anyone here aware of any explicit/definite differences between running sqlclr on 32-bit and 64-bit.

Note: These must be documented, well defined differences.

View 5 Replies View Related

VB - SQL Communication

May 5, 2008

I have a database where it will be simple to calculate needed data. Specifically I need to calculate the sum of several columns based on a number of WHERE constraints. I can write the SQL statements - up to a point. The point is the transition to VB. For a simple example



Select sum(Costs) from Research where (Code = 01213).

Now somewhere I have floatiing around in the machine I have my answer but how do I get the SQL results as a variable I can equate to my Visual Basic variable Total_Research_Costs?

Please also let me know if I have won the stupid question of the month?

Thanks for your help.

View 4 Replies View Related

SQLCLR Web Service

May 9, 2008

I'm having a problem executing a SQLCLR function: this function
calls a web services that processes a query to a data base and
returns a table to be used in a stored procedure. In a low
concurrency scenario (not to many clients connected), the function
returns correctly, however when the concurrency level is increased
we have a SQLCLR command execution problem (all the SQLCLR
processes hangs), making the server unavailable to all web services
processes.



At first we thought the problem could be the SQLCLR, since the web
services is 100% available, all the time. We monitored to come to
this conclusion. Do you know of some SQLCLR bug?



Could someone help me with this? I'm in a difficult situation with
my client, considering that we defended the MS SQLServer technology
and now it's not working properly.

View 7 Replies View Related

CreateProcessAsUser In SQLCLR

May 15, 2006

I'll keep trying new threads here... sooner or later, I'm sure an expert Microsoft CLR employee will gladly lend a helping hand!

The pieces:

1. SQL 2005, MS Windows Server 2003, Standard Edition, SP 1

2. .NET 2005/C#

3. Instance of SQL 2005 running locally.

Trigger on local SQL2005 DB table INSERT calls 2 CLR Functions:

1. Retrieve data from SQL2005 DB table and populate local DBF through OLEDB

2. Call external 16-bit application (written in Clipper) that iterates through local DBF records (added from step 1 above) and populates DBF on domain resource.

Step 2 detail:

External 16-bit application is called by CreateProcessAsUser after impersonating token.

THIS IS SUCCESSFUL - IF: I populate SQL2005 DB table using TSQL insert statement. The trigger executes, Step 1 and Step 2 execute perfectly!

THIS IS UNSUCCESSFUL - IF: The SQL2005 DB table is populated by synchronizing SQL Mobile Server database from a SQL Mobile Edition 2005 PDA emulation. The trigger executes. Step 1 executes perfectly. Step 2 executes without exceptions. HOWEVER, the 16-bit application does not execute! Remember, no exceptions. In fact, the result variable returns true from function below:

result = ProcessUtility.CreateProcessAsUser(

hDupedToken,

null,

@"C:MobileDBMobile.exe",

ref sa, ref sa,

false, 0, IntPtr.Zero,

@"C:MobileDB", ref si, ref pi

);

Also, if I Right-click on the Step 2 function in the Server Explorer and click "Execute", it works perfectly. Domain DBF is updated successfully.

So, in short CLR "CreateProcessAsUser" is not doing it's job when the trigger is fired after SQL 2005 DB is populated via replication/sychronization. I would appreciate a response... Thx!



View 6 Replies View Related

OLE DB Communication Error

Apr 14, 2008

Whe I try to save the package to sql server. I am getting the below error.. there is no error in a package..

"The save to sql server method has encountered OLE DB error code 0X800004005(communication link failure) in ssis"

What is wrong? and how can i fix it?

View 1 Replies View Related

Multiple Server Communication!!!

Oct 8, 2001

I need to get two servers to talk to each other so they can run queries on each other. Any info?

View 2 Replies View Related

Communication Link Failure

Aug 13, 2000

We are developing an ASP ad component for our web site. For the past one week
we are testing the component in real environment. All of a sudden we are getting the following error message.

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC SQL Server Driver]Communication link failure


We are using SQL Server 7.0 with Windows NT4 SP4, IIS and ASP

We are not using any complex joins or view updation. We are using ADODB connection variable with an application scope to establish the connection. When we try to use the connection object to open a Recordset, this error occured. We colsed the connection and destroyed the ApplicationScope Connection object and re-created the object with out any success.

View 2 Replies View Related

Communication Link Failure

Apr 10, 2007

I get ODBC Error 823 when I try to access data from Crystal reports and I/O error, communication link failure...from query analyzer. But the weird thing is it is on and off. If I keep keep clicking 4 times in a row it happens 5 time or 7th time. It is alo only on one of the big tables. They are all stored on same primary filegroup?

Any ideas on what this might be? When I checked BOL it said disk error. The network team doesn't seem to agree. How can I make sure it is hardware or software problem?

Please help.

B.T.W we have SQL 2000 Enterprise.

View 9 Replies View Related

Communication Link Failure...

Jul 20, 2005

Hello,We are the authors of an application written in PowerBuilder (typeClient-Server, database MSSQLServer2000).After some time (1 hour) of client inactivity happens disconnect from serverand aplication reports error 'Communication link failure ...'Please, would you help me, if exists some way how to set up an interval ofthe connectivity between Client and Server. I wasn´t able to find it out inany help or manual.Thank you very much in advance!Pavel

View 1 Replies View Related

Communication Between Two Service Brokers

Aug 2, 2007

I am trying to setup an alert system for our new application. Idea is to create triggers on the tables that we need updates about. When a table changes trigger will be fired and that will send a change data message to a service on a
different sql server. That service will process the message and create an event in the notification services database. Notification service will later send an email or sms etc depeding on what is required.

Currently i got the message exchange working between two service in the same database. Now I am working on exchanging message between two SQL Servers with no luck. Can anyone please post an article on how to setup communications between two services on different servers.

I did try to expose service broker as an endpoint and create a route on the other server to call it? (This don't work)


Thanks,
Fahad

View 3 Replies View Related

SQLCLR - Negative Consequences?

Apr 8, 2008

I'm personally in favor of using the SQL CLR where appropriate, although I'm wondering what the negative consequences of enabling SQL CLR might be? Its disabled by default within SQL Server 2005 and most likely 2008, so what was the reason behind this ... beyond the fear of the DBA enabling something he might not himself fully understand.

Thanks,

Doug Holland

View 1 Replies View Related

Running Process() Within SQLCLR

May 11, 2006

By using impersonation I am able to push data to network path / old fashioned DBF's. Of course, I must use unsafe. I am unable, however to successfully run a "cmd.exe" process(), even if I populate the Username, Domain and password (with securestring). It authenticates correctly (checked by giving wrong password or bad username). But when it runs (even just a "cmd.exe"), I get an access is denied error...



StreamWriter sw = File.CreateText("C:\Error.txt");

WindowsIdentity clientId = null;

WindowsImpersonationContext impersonatedUser = null;

clientId = SqlContext.WindowsIdentity;

impersonatedUser = clientId.Impersonate();

System.Security.SecureString password = new System.Security.SecureString();

foreach (char c in "secret")

password.AppendChar(c);

Process p = new Process();

ProcessStartInfo si = new ProcessStartInfo("cmd.exe");

si.UserName = "MyName";

si.Password = password;

si.Domain = "MySecretDomain";

si.UseShellExecute = false;

try

{

p.StartInfo = si;

p.Start();

}

catch (Exception ex)

{

//handle the exception here (This exception handler will not handle the exception, but I get a

//Window popup (While executing my CLR!!!)

}

finally

{

sw.Close();

}



The message popup says: The application failed to initialize poperly (0xc0000142). Click on OK to terminate the application. I'm kind of at a loss...

I'm using a Windows 2003 server box with the latest SQL Server 2005, .NET 2.0/2005. Let me know if you need anything else.

Oh, just FYI - I am moving replicated data from SQL2005 server to a legacy app using DBF (FoxPro driver). I really need an external DOS app to process some data for the DOS application (Clipper).

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved