Communication link failure error message - sql-server

I'm in the process of testing an application and it's database and for this I want to restart my testing each time completely clean. This application loads a large amount of data from Twitter. Therefore, before I start, I delete all data from the database and kill any processes from my web account associated with this application. When I try to then load my application, I get the following error:
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][SQL Native Client]Communication link failure
I would assume this has something to do with me killing all the related processes in the DB. After some amount of time I am able to run queries again.
Does this have something to do with the connections setup information in Coldfusion Administrator?
Does it just take some time to reset the connection? Is there any way to get around this?
Is there a better way to start fresh and clean when testing the loading?

By default, ColdFusion pools connection threads. I would guess, based on your comment to Stephen Moretti, that you are killing a connection that CF expects to still be live. That said, I've never had problems killing long DB threads, so this is pure speculation.
I'm not sure what killing these threads gets you, as far as testing goes. Once the page has stopped processing, open DB connections should not push or pull additional data.

I suspect that the error is actually related to how you are "cleaning up", particularly when you say "kill all related processes". By this I'm guessing you go into task manager and actually kill the processes.
I'm also guessing that if you're using SQL Server, you're on windows.
Rather than killing processes, cleanly stop the services associated with your application. Go into the Services Control Panel :
Stop your IIS or Apache Service.
Stop your ColdFusion Server instance service.
In terms of your database:
- Create a script for creating your database schema, tables, views, users and permissions and any default data entries
- drop your schema
- restart the sql server services if you want to be sure you've created any cached data out.
- run the script to create a blank of your database.
You could at this point actually create a database back up and just restore this, but its always handy to have the scripts to run on servers if you don't want to restore a backup.
After this start your coldfusion and iis/apache services.

Related

Is there a way to run a MS Access query in the background?

I have form linked to several offsite SQL server tables. When the form is closed, an event is triggered to run some update queries that copy large amounts of data from one table to another. While this is running, I lose control of Access functions. This can take a minute or so since my internet connection is slow. Is there a way to trigger those update queries to run in the background rather than shutting everything in Access down till that close event completely executes?
Short answer is No. Access is single-threaded.
Your only option is to run a second instance of Access, and then push commands to this to carry out such background tasks.
Edit:
You can find a method to implement this setup while distributing frontends in my article:
Deploy and update a Microsoft Access application in a Citrix environment
Thanks, Gustav! I think I'll go ahead and execute a command as soon as my form loads to open a second instance of Access. This second instance will have an AutoExec macro to run my append and update queries then close that database. That should give me my background query. I just need to do a little research on how to trigger that second database to open. Thanks for the idea!

Application with SQL Server express and scheduling a backup everyday

I have an application that is used by more than one user, however backups need to be performed twice a day. I don't have SQL server agent and i was wondering if i should create an exe that would run in the background.
I have read other posts about using the scheduler, but i would look it to be away from the end user and simple exe is used. As i am looking to incorporate sending an email once back up is complete.
basically what is the best approach for creating a backup on SQL server and how does other applications allow for this?
Update
Would a good idea be to create a windows service that checks the time, if time matches then perform backup, i have never created a windows service.
What are the positives and negatives ?
will this start on pc boot?
any other suggestions?

MSSQL Replication: If Publisher/Distributor server goes down

Background
To make the story short, our company is facing the task of making our application redudant and more resilent to heavy loads by load-balancing. The task is on my desk and I've been doing some research as I've never done it before.
Fact
Today we host our application on 1 server and the goal is to have another one to even out serverload with load-balacing.
Issue
I've been doing some research and got stuck on how to setup the MSSQL Replication. If one server goes down the other one must be in sync as the users will be redirected there insted by the load-balancer
The tenthousand view to the solution goes something like: Have a Publisher/Distributor on same server and then add subscriber databases and they will sync between eachother.
Question
What happens if the Publisher/Distrubtor server goes down? Suddenly the system isn't redudant at all. Do we have to setup a Publisher/Distrubtor on each subscriber server to take over the role? I've been search around and haven't found a good answer.
Just hint if the explanation is confusing and I'll fill in the blanks..
Thanks in advance!

Failover strategy for database application

I've got a writing and reading database application holding a local cache. In case of an application server fault a backup server shall start working.
The primary and backup application can only run exclusively because of its local cache and some low isolation level on the database.
As far as my communication knowledge goes it is impossible to let both servers always figure out who is allowed to run exclusively.
Can I somehow solve this communication conflict through using the database as a third entity? I think this is a quite typical problem and there might not be a 100% safe method, but I would be happy to know how other people recommend to solve such issues? Or if there is some best practice to this.
It's okay if both application are not working for 30 minutes or so, but there is not enough time to get people out of bed and let them figure out what the problem is.
Can you set up a third server which is monitoring both application servers for health? This server could then decide appropriately in case one of the servers appears to be gone: Instruct the hot standby to start processing.
if i get the picture right, your backup server constantly polls the primary server for data updates, it wouldn't be hard to check if the poll fails, schedule it again for 30s later 3 times and in the third failure dynamically update the DNS entry to the database server to reflect the change in active server. Both Windows DNS and Bind accept dynamic updates signed and unsigned.

Anyone else heard of coldfusion t-sql use database bug?

On our admin of our company's production site, we have a little query dumping tool, and I unknowingly, in trying to get data from a database, different than the main one, used the use database command.
And here's the kicker, it then made every coldfusion page with it's query instantly fail.
since it somehow caches that use database command.
Has anyone else heard of this weird bug?
How can we stop this behavior?
If i use a "use database" command, I want that to only exist as far as the current query i am running, after i am done, to go back to the normal database usage.
This is weird and a potentially damaging problem.
Any thoughts?
I imagine that this has something to do with connection pooling. When you call close, it doesn't close the connection, it just puts it back into the pool. When you call open, it doesn't have to open a new connection, it just grabs an existing one from the pool. If you change the database that the connection is pointing to, ColdFusion may be unaware of this. This is why some platforms (MySQL on .Net for instance) reset the connection each time you retrieve it from the pool, to ensure that you are querying the correct database, and to ensure that you don't have any temporary tables and other session info hanging around. The downside of this kind of behaviour, is that it has to make a round trip to the database, even when using pooled connections, which really may not be necessary.
Kibbee is on the right track, but to extend that a little further with three possible workarounds:
Create a different DSN for use by that one query so the "USE DATABASE" statement would only persist for any queries using that DSN.
Uncheck "Maintain connections across client requests" in the CF admin
Always remember to reset the database to the one you intend to use at the end of the request. It kinda goes without saying that this is a very dangerous utility to have on your production server!
It's not a bug nor is it really unexpected behavior - if the query is cached, then everything inside the cfquery block is going along for the ride. Which database platform are you using?

Resources