Thursday, March 29, 2012
Consolidate multiple databases via merge replication
I am trying to merge a set of tables from 5 separate databases (4 on
separate servers and 2 on the same server) into one 'master' database.
The tables being replicated all have unique ID ranges
How to I organise the replication so that the subscriber database can allow
inserts which fit into the ID ranges for the related Publishers database.
ie All inserts with a Lab_ID = 'L' should ONLY be replicated back to the
associated publisher.
I am not familiar with the automatic identity range handling .. can anyone
point me to an article about how this works ?
any help would be appreciated
cheers
mike
Mike,
as you've got multiple publishers, just ordinary filters will work to
restrict the flow of data to each publisher. For identity range handling,
you'll need to design each publisher's range yourself. The subscriber table
can be created during the first initialization, and all others are nosync
ones. So, the subscriber's identity range is defined after the first
initialization, and subsequent publications need to be sure not to overlap
with this range. Make the ranges large, because assignment of another range
might cause an overlap, so if the range is so big there will never be any
need to reset then this is best.
Alternatively, all subscriptions can be nosync ones.
These might help:
http://www.replicationanswers.com/No...alizations.asp
http://www.replicationanswers.com/ManualIdentities.asp
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
Tuesday, March 27, 2012
Considerations for packaging MSDE app
I have a C# Winform app which runs using SQL Server.
I want to package up the app, so that it deploys with MSDE.
Can anyone offer any pointers or references to help?
Thanks
Hi Paul,
I hope my suggestions will help you, because I have gone through pure h#$l
getting this to work right.
I have a VB.Net winforms app and I use Wise Installation System to install
the .Net framework, MSDE, the app.
A couple of things tried and failed:
1. Within wise, we installed MSDE with the command line option where it sets
the password. We decided to install MSDE into its own instance becasue we
don't want anyone coming behind us and hosing it up by installing an
untested service pack or anything.
2. At the end of the install, we run a batch file to stop and restart the
SQL service. In retrospect, this may not be necessary because of our
decision to reboot before the app is executed the first time.
3. We attempted to run a batch file to attach the database, but no matter
what we tried, it just would not work. It didn't matter if we rebooted and
then ran the batch, nothing worked. So, I added the code to my app that does
this:
a. check to see if the SQL service is running, if its not, warn the user and
shut down the app.
b. if this is the first time the app is executed:
b1. check to see if the database exists, of course it does not, so using
ado.net, execute the command against the master database to attach the
database. Test again to make sure the database is attached, if not, throw an
exception.
b2. Update my configuration file to show that the app has successfully
initialized.
4. Now here's the real McKoy - in order to get all this to work the first
time I connect to the database to check the version I had to use
POOLING=False in the connection string. Problem: The app ran as slow as a
turtle because now it wasn't using connection pooling anywhere. Solution:
Two connection strings, one for initial startup (first time connection) then
one for the rest of the time (without POOLING=false)
5. Another issue came up of how we would update our database, we surely
didn't want to have to detach and then re-attach another database and blow
peoples data away, so I added a version table to the database and I run a
check on the current version each time the app is executed. If the versions
are the same, I don't execute the update executable. So you may ask, how do
you know if you have a new database version and an update needs to take
place? Answer: When a patch is applied (or an executable update) I have a
Version.xml file where we will put the new version number to be compared
against. The executable that runs the update is also new since it will have
code in it to do the update.
But, here's the big question, after you install MSDE, do you need to reboot
or not? The answer is that I was able to get my app to work without having
to reboot, but we have decided to require a reboot because I just believe
there are things in MSDE that need to be set correctly and I think rebooting
is the only way to do it. Again, my app works without it, but I just feel
like its more proper to reboot. I mean after all, you are installing the SQL
desktop engine which is no minor thing, not to mention the .Net framework
install.
Now, there are probably many MSDE experts out there reading my steps
thinking, man, he did this totally wrong, but I'm telling YOU these are
things you are in the end, probably going to have to do to (especially the
POOLING = False setting).
There are many things we haven't even gotten to yet like:
1. What happens if a person doesn't reboot the machine, how do you stop them
from running the app?
2. What if a person runs the install, uninstalls, then reinstalls and
reboots, how does that affect the app?
3. Do you want the uninstall to uninstall the .Net framework and MSDE? I
personally don't think so but then both these items are rather large.
Hope this helps.
STom
"Paul Aspinall" <paul@.aspy.co.uk> wrote in message
news:ctuKd.9606$n9.2569@.fe3.news.blueyonder.co.uk. ..
> Hi
> I have a C# Winform app which runs using SQL Server.
> I want to package up the app, so that it deploys with MSDE.
> Can anyone offer any pointers or references to help?
> Thanks
>
Tuesday, March 20, 2012
ConnectionString
I'm using Sql Server (SQLOLEDB.1) and I want to connect it by Sqlconnection.
those are the details:
user Id: sa
Password: *****
database: ServiceManagement
server name: KLXPE002\KULMOS
What should be the Connection String?
Thats what i did:
"Persist Security Info=True;Integrated Security=SSPI;server=SQLOLEDB.1;database=ServiceManagement;Data Source=KLXPE002\KULMOS;User ID=sa;password=****"
It doesn't work.
thnx
Itai
Your connection string should look like
"Data Source=KLXPE002\KULMOS;Initial Catalog=ServiceManagement;User Id=sa;Password=asdasd;"
Regards,
Venkatarajan A|||You can visit this site:www.connectionStrings.com|||thank you Venkatarajan its working
Connections made by call to createStatement?
I am using the following code to test connections made to an SQL Server 2000
database:
Statement stmt = con.createStatement ();
stmt.executeQuery ("select * from control");
stmt = con.createStatement ();
stmt.executeQuery ("select * from control");
stmt = con.createStatement ();
stmt.executeQuery ("select * from control");
con has previously been set up as a Connection object obtained via a call to
DriverManager.
When I look at the output of sp_who in SQL Query Analyzer, I see that a new
SQL Server process has been created each time that createStatement is called
(actually, not the first time; only one process exists after that call, and
that process appears after the call to DriverManager.getConnection).
I'm trying to avoid the JDBC driver make multiple connections to the SQL
Server for performance reasons; if it really is making a new connection each
time, that would obviously require some time which I don't want to waste.
It's possible I'm misinterpeting the output of Query Analyzer, and that
multiple database processes can be listed that are all using the same actual
connection (this seems possible, as the output of stmt.getConnection()
remains the same each time a stmt object is allocated in the code above).
Can anyone explain this behavior?
Thanks,
Ryan
Add the property 'selectMethod=cursor' to your connection-getting and this
odd behavior of the driver will go away.
Joe
Ryan McFall wrote:
> Hi:
> I am using the following code to test connections made to an SQL Server 2000
> database:
> Statement stmt = con.createStatement ();
> stmt.executeQuery ("select * from control");
> stmt = con.createStatement ();
> stmt.executeQuery ("select * from control");
> stmt = con.createStatement ();
> stmt.executeQuery ("select * from control");
> con has previously been set up as a Connection object obtained via a call to
> DriverManager.
> When I look at the output of sp_who in SQL Query Analyzer, I see that a new
> SQL Server process has been created each time that createStatement is called
> (actually, not the first time; only one process exists after that call, and
> that process appears after the call to DriverManager.getConnection).
> I'm trying to avoid the JDBC driver make multiple connections to the SQL
> Server for performance reasons; if it really is making a new connection each
> time, that would obviously require some time which I don't want to waste.
> It's possible I'm misinterpeting the output of Query Analyzer, and that
> multiple database processes can be listed that are all using the same actual
> connection (this seems possible, as the output of stmt.getConnection()
> remains the same each time a stmt object is allocated in the code above).
> Can anyone explain this behavior?
> Thanks,
> Ryan
>
Sunday, March 11, 2012
connection with sql server 2000
hi
i am getting error while connecting to sql server in c# 2005. error is :
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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
I don't why this error occured?? Anybody's help would be highly appreciated
Tushar
Hi Tushar,
try to see this forums and maybe get the answer to your question.
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=258082&SiteID=1
Connection to the server is lost.
I have just installed SQL Server 2000 SP3 on 2000 server
.. I am attempting to connect to the Server through the
Analysis Manager, and I am getting an error of:
Cannot connect to the Analysis server on
computer 'computer name'
Connection to the server is lost.
I am able to connect if I use a administrator ID.
Using my ID I can connect using the Enterprise Manager to
the SQL server. On the server itself, I can't get into
Analysis Manager. Can anyone help?
My ID is listed inside the OLAP Administrators local group
on the server.
One more thing is after SP3 instllation, I have installed
and uninstalled EXCEL 2003. To get rid of one
error "version may not be valid" while connecting from
EXCEL To ANalysis Manager. Now this message has gone.
Thanks in advance for any help regarding this
Regards
Sajith
.Have you applied SP3 for SQL and Analysis Services on your client as well as
the server ?
HTH
Jasper Smith (SQL Server MVP)
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"Sajith S" <sajith_sudhi@.hotmail.com> wrote in message
news:1229a01c3f5e1$94476720$a401280a@.phx
.gbl...
> Hi
> I have just installed SQL Server 2000 SP3 on 2000 server
> .. I am attempting to connect to the Server through the
> Analysis Manager, and I am getting an error of:
> Cannot connect to the Analysis server on
> computer 'computer name'
> Connection to the server is lost.
> I am able to connect if I use a administrator ID.
> Using my ID I can connect using the Enterprise Manager to
> the SQL server. On the server itself, I can't get into
> Analysis Manager. Can anyone help?
> My ID is listed inside the OLAP Administrators local group
> on the server.
> One more thing is after SP3 instllation, I have installed
> and uninstalled EXCEL 2003. To get rid of one
> error "version may not be valid" while connecting from
> EXCEL To ANalysis Manager. Now this message has gone.
> Thanks in advance for any help regarding this
> Regards
> Sajith
> .
>|||I did. But still the same error message.
So I have done the following workarounds
1. Uninstalled Analysis manager, Deleted the Olap
Administrators ID.
2. Installed Analysis Manager,Olap Administrator ID
created again by Analysis Manager. Applied SP3a.
Now everything found to be working...Thanks for the help.
>--Original Message--
>Have you applied SP3 for SQL and Analysis Services on
your client as well as
>the server ?
>--
>HTH
>Jasper Smith (SQL Server MVP)
>I support PASS - the definitive, global
>community for SQL Server professionals -
>http://www.sqlpass.org
>
>"Sajith S" <sajith_sudhi@.hotmail.com> wrote in message
> news:1229a01c3f5e1$94476720$a401280a@.phx
.gbl...
to
group
installed
>
>.
>
Thursday, March 8, 2012
Connection to SQL Server 2000 thinks it is 2005
I have a SQL Server 2000 database that I can connect to from an ASP.NET web
site quite happily. Using the same connection string in a Windows Forms
application I get the message "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: Named Pipes Provider, error: 40
- Could not open a connection to SQL Server").
Please could anyone advise.
Marek
Hi
It does not think it is SQL Server 2005 ("when"), but gives additional
information, in case you are trying to connect to SQL Server 2005. Part of
the enhanced error information that helps with troubleshooting.
Have you tried connecting though TCP/IP (adding "Network Library=DBMSSOCN"
to your connection string)?
You web server might be configured differently. Running cliconfg.exe on your
machine will allow you to configure the default library.
Regards
Mike
This posting is provided "AS IS" with no warranties, and confers no rights.
"Marek" <mav@.community.nospam> wrote in message
news:B89D86BB-AF20-4E90-89AE-C690A07BC232@.microsoft.com...
> Hi
> I have a SQL Server 2000 database that I can connect to from an ASP.NET
> web
> site quite happily. Using the same connection string in a Windows Forms
> application I get the message "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: Named Pipes Provider, error:
> 40
> - Could not open a connection to SQL Server").
> Please could anyone advise.
> Marek
Connection to SQL Server 2000 thinks it is 2005
I have a SQL Server 2000 database that I can connect to from an ASP.NET web
site quite happily. Using the same connection string in a Windows Forms
application I get the message "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: Named Pipes Provider, error: 4
0
- Could not open a connection to SQL Server").
Please could anyone advise.
MarekHi
It does not think it is SQL Server 2005 ("when"), but gives additional
information, in case you are trying to connect to SQL Server 2005. Part of
the enhanced error information that helps with troubleshooting.
Have you tried connecting though TCP/IP (adding "Network Library=DBMSSOCN"
to your connection string)?
You web server might be configured differently. Running cliconfg.exe on your
machine will allow you to configure the default library.
Regards
--
Mike
This posting is provided "AS IS" with no warranties, and confers no rights.
"Marek" <mav@.community.nospam> wrote in message
news:B89D86BB-AF20-4E90-89AE-C690A07BC232@.microsoft.com...
> Hi
> I have a SQL Server 2000 database that I can connect to from an ASP.NET
> web
> site quite happily. Using the same connection string in a Windows Forms
> application I get the message "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: Named Pipes Provider, error:
> 40
> - Could not open a connection to SQL Server").
> Please could anyone advise.
> Marek
Friday, February 24, 2012
Connection string Problem
Hi!
I have a very silly problem here.
i am setting some variables here from c# code.
Everything works fine except for Conn string. I understand statements that works fine in SQL does not act same in C# because of string literals.
I need an extra qoute \"" ......."/" that would execute in C#
\""Data Source=SE413695\AASQL2005;Initial Catalog=TestDB;Integrated Security=SSPI;"\"
where as in c#
setting variable value as :
string scriptTaskConnectST = @."Data Source=SE413695\AASQL2005;Initial Catalog=TestDB;Integrated Security=SSPI;";
executing this through c# code
jobCommand = new SqlCommand("xp_cmdshell 'dtexec /f \"" + path + "\" /Set \\package.Variables[User::ArchivePackageName].Properties[Value];\"" + name + "\" /Set \\package.Variables[User::ScriptTaskConnectST].Properties[Value];\"" + scriptTaskConnectST + "\"
When i check i resulting vaue i get this for scriptTaskConnectST as
/"......\"
\"Data Source=SE413695\AASQL2005;Initial Catalog=TestDB;Integrated Security=SSPI;\"
how should i format it to get \""......"\"
Thanks,
Jasm
if i'm not mistaken, you've already asked this question in a previous incarnation. if true, i believe that i've already suggested that you use sql server agent stored procedures to run your package. you can execute any stored procedure from c# provided that your code has the proper permissions.
does my suggestion not work for you? if so, please tell me why that is.
|||I need to execute the packages through C# UI. Executing Throught the Agent is a secnd case now. But i found a work around method to set the connection string in my main package and set the value into the varaible which is used by all the pther sub packages. and it is working now.
I am already executing Stored proceedure through c# now for other implementations.
Thanks for your Suggestion.
Once i finish working through the UI i will try to execute throught the agent.
Jas
Connection string problem
I am manually able to create a connection to my db in the vs2005 ide using
Tools->Connect to Database. In the connection I see 'Data
Source=MYSERVER;Initial Catalog=aspnetdb;Integrated Security=True' as the
connection string and 'NET Framework Data Provider for SQL Server' as the
provider. Following these settings in my code and I have used the connection
string;
<add name="Membership" connectionString="Data Source=MYSERVER;Initial
Catalog=aspnetdb;Integrated Security=True"
providerName="System.Data.SqlClient"/
in my app's web.config file. This connection is then used by a custom
membership provider for the create user wizard. Now when I try to create a
new user in the wizard I get the following error;
System.Data.SqlClient.SqlException: Cannot open database "aspnetdb"
requested by the login. The login failed.
Login failed for user 'MYSERVER\ASPNET'.
I was able to work fine when the db was on sql express. What is the problem
and how can I fix it?
Thanks
RegardsJust allow the aspnet user permissions over the db or specify a user. Its because the aspnet user doesnt have permissions to thedb. The connection string is fine. The easiest way is just tospecify a user and give it permission. This way its more secureanyway.|||
The problem is that the asp.net web application is running as an anonymous user, and you haven't given database access to that account (MYSERVER\ASPNET). When you do it in the IDE, it's using your user access right (MYSERVER\YOU).
A bunch of ways to fix it. Run the asp.net app as you is one way (not recommended). Grant access to the myserver\aspnet user is the better approach. Create him a log in to the sql server, grant him access to the database, and give him enough rights to do what you need to do from the web.
|||How do you grant access myserver\aspnet user?
Thanks
|||It's quite easy.My instruction is based on SQL Server 2000:
In Enterprise Manager:
1. Right click on the ASPNET account. (I assume you can do this!)
2. Click on the "Database tab"
3. In the database section (immediately below), place a tick in thecheckbox to the left of the database, if you want ASPNET to access thisdatabase.
Exit the dialog boxes.
If you are using stored procedures, you will need to grant EXEC access.
In Enterpise Manager:
1. Right click on the stored procedure.
2. Choose "properties"
3. Choose "permissions"
4. For "public", check the "Exec" column.
Do for all stored procedures.
Sunday, February 12, 2012
Connection Prodlem-with instance node
I have an active/passive sql server 2000 cluster. Most of the time I remote-login into the server and use the enterprise manager to work. But now when I click on either of the node I get the following error:
Encryption not supported on SQL Server ConnectionOpen (PreLoginHandshake())
But I'm able to connect to the server from my desktop.
Any help in this regard?
Thanks,
This means that the "Enable Protocol Encryption" option was set on the
machine you're using as a client.
Use the SQL Client Network Utility to uncheck this.
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.
|||Hi Kevin
Thank you so much it worked.
Razi
"Kevin McDonnell [MSFT]" wrote:
> This means that the "Enable Protocol Encryption" option was set on the
> machine you're using as a client.
> Use the SQL Client Network Utility to uncheck this.
> Thanks,
> Kevin McDonnell
> Microsoft Corporation
> This posting is provided AS IS with no warranties, and confers no rights.
>
>
|||You're welcome!
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.
Connection Prodlem-with instance node
I have an active/passive sql server 2000 cluster. Most of the time I remote-
login into the server and use the enterprise manager to work. But now when I
click on either of the node I get the following error:
Encryption not supported on SQL Server ConnectionOpen (PreLoginHandshake())
But I'm able to connect to the server from my desktop.
Any help in this regard?
Thanks,This means that the "Enable Protocol Encryption" option was set on the
machine you're using as a client.
Use the SQL Client Network Utility to uncheck this.
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.|||Hi Kevin
Thank you so much it worked.
Razi
"Kevin McDonnell [MSFT]" wrote:
> This means that the "Enable Protocol Encryption" option was set on the
> machine you're using as a client.
> Use the SQL Client Network Utility to uncheck this.
> Thanks,
> Kevin McDonnell
> Microsoft Corporation
> This posting is provided AS IS with no warranties, and confers no rights.
>
>|||You're welcome!
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.
Friday, February 10, 2012
CONNECTION PROBLEM ON WIN2003
i have sqlserver that running on windows 2003
i have connecton to this server from an other computer
and i need tcp/ip connection to this sql server
but i cant connect to this sql with this port
when i use netstat -an i dont see this port(1433) on protocal list and
also
icant telnet to this server with this port
can you tell me how can i solve this problem
* note : tcp/ip protecol is enabled
Is there a firewall between you and the server? If so, make sure port
1433 is open, most firewall setups these days block that port for
security.
|||Perhaps, it is not listening on 1433. Go to the errorlog for the SQL
instance and verify the TCP port it is listening on, or use TcpView.exe from
www.sysinternals.com, though TcpView doesn't always display the port number
of a listening server.
Also from this other computer, to be sure, I'd try (or use whatever the
listening port):
cmd>osql.exe -Stcp:<IP address>,1433 -Uuser -Ppassword
If it doesn't work, remote desktop to the server, and try the above locally.
Linchi
"Savas Ates" <savas@.indexinteractive.com> wrote in message
news:uuP7jp$0FHA.3892@.TK2MSFTNGP12.phx.gbl...
> hi
> i have sqlserver that running on windows 2003
> i have connecton to this server from an other computer
> and i need tcp/ip connection to this sql server
> but i cant connect to this sql with this port
> when i use netstat -an i dont see this port(1433) on protocal list
> and also
> icant telnet to this server with this port
> can you tell me how can i solve this problem
> * note : tcp/ip protecol is enabled
>
>
|||I asked my ISP and they said there is no firewall or blocking on this port..
They also said they cant reach on this port and something wrong with sql
set up.. On my local pc i wrote netstat (there is no problem on my local
sql) i didnt see 1433 port.. Therefore i checked my port number from server
utilities from sql server it was 1433.. What can it be ?
"Savas Ates" <savas@.indexinteractive.com>, haber iletisinde unlar
yazd:uuP7jp$0FHA.3892@.TK2MSFTNGP12.phx.gbl...
> hi
> i have sqlserver that running on windows 2003
> i have connecton to this server from an other computer
> and i need tcp/ip connection to this sql server
> but i cant connect to this sql with this port
> when i use netstat -an i dont see this port(1433) on protocal list
> and also
> icant telnet to this server with this port
> can you tell me how can i solve this problem
> * note : tcp/ip protecol is enabled
>
>
CONNECTION PROBLEM ON WIN2003
i have sqlserver that running on windows 2003
i have connecton to this server from an other computer
and i need tcp/ip connection to this sql server
but i cant connect to this sql with this port
when i use netstat -an i dont see this port(1433) on protocal list and
also
icant telnet to this server with this port
can you tell me how can i solve this problem
* note : tcp/ip protecol is enabledIs there a firewall between you and the server? If so, make sure port
1433 is open, most firewall setups these days block that port for
security.|||Perhaps, it is not listening on 1433. Go to the errorlog for the SQL
instance and verify the TCP port it is listening on, or use TcpView.exe from
www.sysinternals.com, though TcpView doesn't always display the port number
of a listening server.
Also from this other computer, to be sure, I'd try (or use whatever the
listening port):
cmd>osql.exe -Stcp:<IP address>,1433 -Uuser -Ppassword
If it doesn't work, remote desktop to the server, and try the above locally.
Linchi
"Savas Ates" <savas@.indexinteractive.com> wrote in message
news:uuP7jp$0FHA.3892@.TK2MSFTNGP12.phx.gbl...
> hi
> i have sqlserver that running on windows 2003
> i have connecton to this server from an other computer
> and i need tcp/ip connection to this sql server
> but i cant connect to this sql with this port
> when i use netstat -an i dont see this port(1433) on protocal list
> and also
> icant telnet to this server with this port
> can you tell me how can i solve this problem
> * note : tcp/ip protecol is enabled
>
>|||I asked my ISP and they said there is no firewall or blocking on this port..
They also said they cant reach on this port and something wrong with sql
set up.. On my local pc i wrote netstat (there is no problem on my local
sql) i didnt see 1433 port.. Therefore i checked my port number from server
utilities from sql server it was 1433.. What can it be ?
"Savas Ates" <savas@.indexinteractive.com>, haber iletisinde unlar
yazd:uuP7jp$0FHA.3892@.TK2MSFTNGP12.phx.gbl...
> hi
> i have sqlserver that running on windows 2003
> i have connecton to this server from an other computer
> and i need tcp/ip connection to this sql server
> but i cant connect to this sql with this port
> when i use netstat -an i dont see this port(1433) on protocal list
> and also
> icant telnet to this server with this port
> can you tell me how can i solve this problem
> * note : tcp/ip protecol is enabled
>
>