Showing posts with label local. Show all posts
Showing posts with label local. Show all posts

Wednesday, March 21, 2012

Interesting ID issues...

Hi all,
I have a system in place currently that both a local and a live database, currently the sales database is kept in line with a home grown "syncronise" script that controls keeping the two tables (live and local) in sync with the use of Local and Remote ID's

For example;
Table "Sales"
ID - Int
RemoteID - Int
Various Data fields


The 'Live' System writes new records using the RemoteID field, whilst the local inserts new records using the ID field. The Sync script copies the data up/down and assigns the corresponding RemoteID/ID's to the records as they are copied accordingly.

Its been decided that this process must change, in favor of Two Way Replication. I have been tasked with finding the solution to the safe handling of ID's as theres a danger that two people can be writing a record (one live, one local) and possibly create the same ID's - i know that replication has its own ID's and could probably manage this well on its own, but these 'Internal' ID's have to be unique due to business rules.

So i have been considering two possibilities to address this problem,
1. Staggering the ID's - for instance Live ID's begin at 1,000,001 and local ID's begin at 1.
2. Having a controlling ID table which provides the next ID

Both options have their advantages and disadvantages, with option 1 we will run into a problem later when the local ID's reach the 1 million mark (a few years away, i admit) and option 2 will need careful locking/transactional code to ensure the same ID isnt given twice.

Does anyone have experience with this kind of issue? or could suggest an alternative approach to this problem?

Thanks in advance!

Replication ( of any type) by itself does not genrerate any Id's for you. Replication is just a process of copying the data from A to B and/or B to A. You can however, set up 2 range's of Id's for the 2 columns but like you mentioned you could run into issues in future and it could be sooner than later depending on how your data changes. And option 2 does create locking issues.

Now my question is since the 2 columns are different what is the need to keep them in the same table? Are local Id's from your local testing or do they hold any significance? I am trying to understand your design. Looks like you have 2 tables with same data (in 2 db's over 2 servers)?

There is a Peer-Peer Replication option available in SQL 2005 where you can insert data in either of the peer's and replication will take care of sync'ing them.

|||

I work for a Dotcom and we have two databases, one on our 'hosted' live servers and one in the local office.

Historically we have used two seperate ID fields, one live (RemoteID) and one local (ID), to allow staff to create sales records locally and customers to create sales records on the live systems. We have a script that then pulls down/copies up the new records and manages the ID's. Due to our sales increasing over the last 12 months this script can no longer handle the work in a timely fashion so another solution is required.

The ID numbers need to be the same, locally and live as this is part of the reference number given to the customer, its been communicated to me that the company wants to keep only a single ID record for sales now and not have to manage multiple ID fields, the company also wants to use replication to manage the data movement. So i need to find a solution for this.

The database can get quite busy under peak load, so i need a solution thats fast, efficient and capable of handling a lot of new records whilst still allowing staff to create local sales and customers to create live sales simultaneously without getting the ID's mixed up.

Using a control table for ID's was a thought, but my concern is speed and locking under heavy load

Monday, March 12, 2012

Interaction between tables of local and remote SQL databases

Hi all,

I would be very glad if someone can suggest me what techniques I should use in the following scenario:

I have 2 SQL Server databases : DB1 and DB2. DB 1 is on a remote server (hosting server) and DB 2 is on a local server.

Some tables of each db contain tables that are polulated and changed by the appropriate application, i.e.:

DB1.users, DB1.orders,... etc are managed by "webapplication"

DB1.products ... are not managed by "webapplication" : in fact only used to read from

DB2.products, DB2.customers, .... etc are managed by "winapplication"

DB2.orders,....are partially managed by "winapplication"

Since the amount of data can go over 100000 records i'm wondering what would by the best approach to :

- synchronize the data of DB1.products and DB2.products in DB1 on remote server (updated newly added rows and update changed rows,....)

- the products data is only (at the moment) added, edited and deleted on the local server

I think SQLBulkCopy will not do the job. Should it be possible with some query? Or...?

Any suggestions are appreciated!!

O.

Some addition:

- Does SQLBulkCopy copy-append data to the destination database.table?

- What about identity keys?

- Should it be the best solution to modify the SqlCommand so it takes only those rows I want to be inserted as (depending on bulkcopies already done before) or is this done by SQLBulkcopy itself....?

Please inform.

O.

Sunday, February 19, 2012

Integrated Security with local SQL & IIS

I have SQL RS running on a Win 2K (dev only) machine with IIS on the same local machine. I am trying to access the reports from another computer, but am getting an error An error has occurred during report processing. (rsProcessingAborted) Get Online Help Cannot create a connection to data source '<Shared Data Source Name>'. (rsErrorOpeningConnection) Get Online Help Login failed for user '<DOMAINNAME>\Guest'.

IIS and the Datasource are setup for integrated security and the Datasource is aimed at the local SQL DB. Anonymous access is turned off in IIS and it prompts for the login info when trying to access it via the web. My understanding is that this should work without problems due to IIS & SQL being on the same machine, but I can't seem to get it to work. Is there a doc somewhere or anything that goes thru the settings so I can see what I'm missing? Or does anyone have any ideas?

Thanks.

Does it work if you access the reports locally? How about using stored windows credentials for hte data source instead of integrated security?|||

Yes, the reports work fine locally. I just can't access them from another machine. I need to use integrated security due to needing the windows login to lookup the correct info in the report and to know the type of user (admin, basic, etc).

Thanks for your help.

|||

Probably a kerberos configuration issue. Try forcing NTLM. See the workaround in http://support.microsoft.com/default.aspx?scid=kb;en-us;871179