Hey Guys,We have a merge replication on 2 MsSQL servers and wondering if its possible to allow the 2 connection strings in our application?So if SQL Server 1 doesnt responed, then the other one will take over.we currently have this in our global.asax:Public Shared dbConnString as String = "Server=xxxx;Initial Catalog=xxxx;User Id=xxxx;Password=xxxx;" So is it possible to change this to look up the first server and then connect to a second server if needed?Thank you for any advice at all.
My company has valuable data being constantly logged to a database 24/7. Actually, the data logs to two separate database systems in case one goes down for whatever reason such as power failure, routine maintenance, glitch, whatever. These two systems are housed at different physical locations.
We are planning to set up a third database system which polls the other two every minute. It compiles and mantains a deduped, clean, and complete collection of data from the other two database systems. If one of the first two systems goes down or misses a row, the third will automatically get the data from the other system. If this deduped database system goes down, we can rebuild the data from the other two.
Does this seem like the right route to take or is there a simpler or safer route available?
What is the best way to insure 100% availability of our SQL databases? Should we use clustering, mirrored servers (Vinca or Double-take)? What are other organizations doing about this?
After some feedback from some of you who might have done something similar:
We are going to be having 3 SQL servers (running SQL Std licence). 2 Are live 1 is a hot swap in the event that we have a total loss of either of the SQL boxes. Basically what I am wanting to do, is have the hot swap being updated periodically so that the databases are being replicated on this box, so that if the live one fell over, we could very quickly get the hot swap into take over.
Can anyone offer any perspectives on the best method of attack for this?
Hey guys...i've got a problem wif my stored procedures...in which my page keep repeating the same data...so to counter this problem i use SELECT DISTINCT instead of just SELECT..but the problem is when i change SELECT into SELECT DISTINCT...the page will not be display,page error....for your information my stored procures was auto generate from some security sofware...so can guys help me out with my code... SELECT DISTINCT t.TargetID, 'V' RecordType, t.TargetDNSName [Target DNS Name], t.TargetIPAddress [Target IP], t.TargetIPDisplay [Target IP Display], t.TargetOSName, t.TargetOSRevisionLevel, v.SecChkID, v.Severity, sc.TagName [Tag Name], sc.ChkBriefDesc [Tag Brief Desc], sc.ChkName [Tag Chk Name], CONVERT(NVARCHAR(4000),sc.ChkDetailDesc) [Tag Detail Desc], CONVERT(NVARCHAR(4000),r.RemedyDesc) [Remedy], o.ObjectID, o.ObjectTypeDesc [Object Type Desc], o.ObjectName [Object Name], s.SensorDataID, a.AttributeName, a.AttributeValue, NULL [Port],NULL [Service Name],NULL [Protocol] FROM #Vulns v INNER JOIN TargetHost t (NOLOCK) ON v.TargetID = t.TargetID INNER JOIN (SecurityChecks sc (NOLOCK) LEFT OUTER JOIN Remedies r (NOLOCK) ON sc.SecChkID = r.SecChkID) ON v.SecChkID = sc.SecChkID INNER JOIN ObjectView o (NOLOCK) ON v.ObjectID = o.ObjectID LEFT OUTER JOIN SensorData1 s WITH (NOLOCK, INDEX(SensorData1_AK3)) ON v.ObservanceID = s.ObservanceID AND s.Cleared = 'n' LEFT OUTER JOIN SensorDataAVP a (NOLOCK) ON s.SensorDataID = a.SensorDataID AND a.AttributeValue IS NOT NULL AND a.AttributeValue != ''UNION ALL
I have a table that I want to have a precalulcate length on a character fieldand group and sum up. Thought I could do this by creating a view with a groupby clause that includes the sum function. Unfortunately, the compilercomplains with:A clustered index cannot be created on the view 'MyView' because the indexkey includes columns which are not in the GROUP BY clause.Wish I could verbalize the problem a little better, but the following pareddown example should serve as a demonstration:SET ANSI_WARNINGS ONSET ANSI_PADDING ONSET ANSI_NULLS ONSET ARITHABORT ONSET CONCAT_NULL_YIELDS_NULL ONSET QUOTED_IDENTIFIER ONSET NUMERIC_ROUNDABORT OFFGOCREATE TABLE myTable(myID INT NOT NULL,RecNum INT NOT NULL,TestString VARCHAR(80) NOT NULL)GOINSERT INTO myTable VALUES(1, 1, 'a')INSERT INTO myTable VALUES(1, 2, 'ab')INSERT INTO myTable VALUES(2, 2, 'abc')GOCREATE VIEW dbo.MyView WITH SCHEMABINDING ASSELECTmyID = myID,slen = SUM(LEN(TestString)),recn = COUNT_BIG(*)FROM dbo.myTableGROUP BY myIDGOCREATE UNIQUE CLUSTERED INDEX IX_MyView ON MyView(myID, slen)-- A clustered index cannot be created on the view 'MyView' because-- the index key includes columns which are not in the GROUP BY clause.GODROP VIEW MyViewGODROP TABLE myTableGOThanks,Chris Rathman
Today a vendor bluntly stated that VMWare provides the same failover and redundancy for SQL that would render "AlwaysOn" high availability unnecessary.
Essentially that VMWare would detect a problem and failover and have .9999 uptime .
We have a SQL database that uses Active Directory with Windows Authentication. Can users that are members of the Active Directory group that has read/write access to the SQL database create ODBC connections to access the database directly and update the data? They dont have individual logins on the server. They are only members of the Active Directory group that has a login?
I am fairly new to mobile development and im trying to write a simple application that can read, write from a SQL Server Mobile Database and load data into a list view. The problem im having is trying to find examples on how to do this and i cant seem to get many of the ones i find to work properly. Im still use to recordsets and adodb and if anyone has any examples on how to do this that would be great.
Also, would it possible if someone could explain this code to me as well
Dim conn As SqlCeConnection = Nothing Dim cmd As SqlCeCommand = Nothing Dim rdr As SqlCeDataReader = Nothing
Try ' Open the connection and create a SQL command ' conn = New SqlCeConnection("Data Source = AdventureWorks.sdf") conn.Open()
cmd = New SqlCeCommand("SELECT * FROM DimEmployee", conn)
rdr = cmd.ExecuteReader()
' Iterate through the results ' While rdr.Read() Dim employeeID As Integer = rdr.GetInt32(0) ' or: rdr["EmployeeKey"]; Dim lastName As String = rdr.GetString(5) ' or: rdr["FirstName"]; End While
' Always dispose data readers and commands as soon as practicable ' rdr.Close() cmd.Dispose() Finally ' Close the connection when no longer needed ' conn.Close() End Try
Hi to all, I was visting one hosting company website and was reading there hosting plans. One line I got there (Maximum number of 50 simultaneous connections are allowed per user/DataBase.). What is the meaning of this line? Big Thanks! Harsh
I'm trying to work out how facebook displays so much information easily. Each time you visit your profile a load of new info is shown. Is each piece of info, which is stored in different table, gathered right there and then? If so, isn't that a helluva lot of connections? I'm trying to implement something into my website where it records history, a it like on facebook when it says "Steve has written on Paul's wall" the names are clickable. Has the information been stored like:
Name1ID ActionID Name2ID23432 56 32432
If so, wouldn't 3 connections be needed? 2 to retrieve the names and 1 for the action? It would be easier to store the info as "Steve has written on Paul's Wall" in 1 field, but it wouldn't be dynamic. And if the page shows a lot of information like that, it's hundreds of conections on just 1 viewing. I'm still learning and am also wondering how many connections per page would take up a lot of resources?
I'm using Visual Studio.Net enviroment, i have SQL desktop Engine installed and everything is working great. I have a problem that whenever i create a new database connections i can NOT delete it. I know that i have to select the node containing the connection and then press the DEL Key, but it seems that the delete option is not valid!
I have a need to connect to a remote (i.e. database on the clients site) SQL Server database from a live application. It is relatively easy under Oracle, but I havent tried to do to an SQL Server. Has anyone done this? The remote SQL Server database in question is 6.5 You can set up odbc connections to remote clients (99% sure on this) so you could go this way. You can also connect directly to a sql box through an IP address in sql7, but I am not too sure how it is with 6.5.
Is there any way to know the number of current connections to an SQL Server Database? Also how can one change the max pool size (for the number of connections allowed to the database)?
I need to restore my database and I keep getting a database in use error. Can someone tell me the easiest way to drop all connections to a database and open it exclusively?
Also, I'm not sure where this connection is coming from, there is another database on the same machine that has user connected, can these connections be the problem?
I am new to SQL Server 7 and am not sure how to handle setting up/importing FoxPro databases. The consultants that setup the database before me have combined all of the FoxPro databases into one big database in SQL server. The reasoning was that for user applications to have access to different databases in SQL they would need a connection for each database they are using, so if all the data is put into one database then the user would only have one database connection instead of 6 or 7.
Does this make sense to anyone? Someone else thought that this might have been true is SQL Server 6.5 but not in SQL Server 7.0. Any help will be appreciated.
I have a user AD account SOPUSJSmith for example. I have given this account security admin at the SQL Server level and dbo at the database level. Is there any way to prevent them from using ODBC to pull data into an Access DB or an Excel spreadsheet?
hi my local host cannot open the connection to my database, whilst testing with vwd seems to be able to do this? other server side functions work (response.write("hello world")) in my iis the version of .net it says its running reads: 2.0.50727, though when i go to add / remove programmes i have 3.5 there? maybe its nothing to do with .net versions? thanks in advance for your help pete
Hello, I'm attempting to generate a dropdownlist by binding it to a database table. My screen has a view of the records plus a footer for inserting new records. I want to populate a drop down list of items from the database on both FooterTemplate and EditItemTemplate. I can successfully create the list on FooterTemplate (the insert new record fields). Here, I have no problems with my database connections. On page load, if I hit 'Edit', it gives me this error: There is already an open DataReader associated with this Connection which must be closed first. I tried closing the datareader and I get an error: Invalid attempt to Read when reader is closed. Here's the snippet of code: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here LoadDataFromDB() If Not IsPostBack Then DataBindGrid() End If End Sub Sub LoadDataFromDB() Dim strSQLStmnt As String Dim cmdDefaults As SqlCommand ' Create new command object passing it our SQL query ' and telling it which connection to use. strSQLStmnt = "SELECT tblTemplates.TemplateID, tblTemplates.Description, " _ & "tblTemplates.Tuition, tblTemplates.Books, tblTemplates.TrainingTable, tblTemplates.Housing, " _ & "tblResidency.ResidencyType, tblCategory.Type, tblCategory.Description AS CategoryDesc, " _ & "tblScholarship.ScholarshipType FROM tblTemplates INNER JOIN tblResidency ON tblTemplates.ResidencyID = " _ & "tblResidency.ResidencyID INNER JOIN tblScholarship ON tblTemplates.ScholarshipID = tblScholarship.ScholarshipID " _ & "INNER JOIN tblCategory ON tblTemplates.CategoryID = tblCategory.CategoryID" cmdDefaults = New SqlCommand(strSQLStmnt, conDefaults) ' Open the connection, execute the command, and close the connection. conDefaults.Open() rdrDefaults = cmdDefaults.ExecuteReader(System.Data.CommandBehavior.CloseConnection) DefaultsDataGrid.ShowFooter = True End Sub Sub DataBindGrid() DefaultsDataGrid.DataSource = rdrDefaults DefaultsDataGrid.DataBind() End Sub Function BindResidency() As DataSet 'Populate the ddlDataSet Const strSQLDDL As String = _ "SELECT Distinct ResidencyID, ResidencyType FROM tblResidency" Dim myDataAdapter As SqlDataAdapter = New _ SqlDataAdapter(strSQLDDL, conDefaults) myDataAdapter.Fill(ddlDataSet) Return ddlDataSet End Function And the asp.net: <asp:TemplateColumn HeaderText="Residency"> <ItemTemplate> <%# Container.DataItem("ResidencyType") %> </ItemTemplate> <FooterTemplate> <asp:DropDownList id="add_residency" runat="server" Width="178px" DataSource="<%# BindResidency() %>" DataTextField="ResidencyType" DataValueField="ResidencyID"> </asp:DropDownList> </FooterTemplate> <EditItemTemplate> <asp:DropDownList id="edit_residency" runat="server" Width="178px" DataSource="<%# BindResidency() %>" DataTextField="ResidencyType" DataValueField="ResidencyID"> </asp:DropDownList> </EditItemTemplate> </asp:TemplateColumn> Any help would be appreciated! Thanks, Curtis
I have a DLL that acts as an interface between the application and the database. So you create a new instance to the database via:
MyDatabaseClass db = new MyDatabaseClass()
Each instance of the class creates a new connection to the database.
So if I were to have the following, then 4 connections would be made.
MyDatabaseClass db1 = new MyDatabaseClass() MyDatabaseClass db2 = new MyDatabaseClass() MyDatabaseClass db3 = new MyDatabaseClass() MyDatabaseClass db4 = new MyDatabaseClass()
My question is...What if instead of creating new connections upon each instantiation, I re-use the same connection through a "ConnectionManager" class. In this way, the above code will only create 1 connection instead of 4.
What do you guys think about each approach? Obviously the 2nd approach makes sense for non-web applications, but what about websites? Would that just cause that single connection to be overloaded??
I created this trigger on a table that i think failed while execution. I tried to modify it and run it again but it seems that i cant do that. If i try and delete the database i also cant - saying that it is still in use. But i am not using it and ther are no other users connected to it. I think the trigger has probably hit a loop and that is holding the link.
To close that i know that a solution would be to restart the SQL server instance but that would be a bit hard since the SQL server where my test database resides is a production server and has few other databases that are important and few users use them.
Is there any way through a SQL statement that there can be forced a delete? Or force close all the connections? Or force close all the processes without actually restarting the SQL server instance.
I have tried all options that were offered on some other forums like forcing it to a single user but even that operation can not be performed saying that the database is still in use.
I have installed MS SQL 2005 in my system. I have created one database in my server. When iam running my application with this connections it is working fine in my local system. When i uploaded the database to some where dataserver, Iam not getting the connectins due to no remote access .
Some body suggested that to start the SQL browser in the SQL Server Configuration Manager.
I go there n tried to start the service when i put the service properties to Automatic or Manual i am getting the error message that is saying that the service is disabled cannot start automatically.
We utilise SQL scripts, executed via sqlcmd.exe, to upgrade the schema and common data of our database(s) when we deploy new versions of our software to a production site. At the moment we simply wait until after hours to do the upgrade and ask nicely for all users to not use the system for a while.
Obviously, asking nicely doesn't always work, and there is also the issue of scheduled server tasks and web services / web sites that operate against the database 24/7.
What are our options for putting the entire server (or preferrably just one database) into a semi-offline state so that users and services cannot connect to it while our script connects and performs the upgrade? I imagine there may be several approaches each with their own pros and cons.
If you could point me in the right direction or perhaps mention what strategy has worked for you, it would be greatly appreciated. We perform these upgrades from hundreds of kilometers away via VPNs and Remote Desktop so we can't just unplug the network cable :).
I'm looking for the correct permissions to grant a user the ability to be able to drop all connections on a database.
The following code throws an exception:
Dim srv As New Server(SqlServerName)
If srv.Databases.Contains(siDBName) Then srv.KillAllProcesses(siDBName) '== the srv.KillDatabase will not work here, we must kill the processes first Dim db As Database = srv.Databases(siDBName) db.Drop() End If
Throws the Exception: Microsoft.SqlServer.Management.Smo.FailedOperationException: Drop all active database connections failed for Server 'xxxx'. The user does not have permission to perform this action.
This code DOES NOT throw an exception when run as an Administrator. Any Ideas?
I need to find a way to identify SPIDS where queries are connected to certain databases using the 4 dot notation instead of actually being connected to the database in question.
For instance, I connect and my default database is MASTER. In MASTER, instead of typing USE MyDb ahead of my query, I just type my query as:
SELECT Col1, Col2 FROM MyDB.dbo.MyTable
The above is the simple scenario. We usually have queries connecting 3 or 4 user dbs together. So database1 might have a query pointing to database2. What I need is a way to identify the SPIDS that are connecting to database2 despite being in database1.
I've developed an asp.net 2.0 web app with vs 2005 and am using a SQL Server 2005 Express database. The app works fine locally, but after uploading to the remote web server the following error occures: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
How do I go about granting remote connections to SQL Server Express?
Does the web server have to have SQL Server Express installed in order to run apps that utilize SQL Server 2005 Express databases?
Do I grant access locally on my machine or do I have to be on the web server to grant remote connections?
I've been using .net 1.1 with access databases for the past couple of years, so this is all new to me.