Is it possible to implement a service broker to receive messages from SQL Server in a language like Python, or does it always have to be in some .Net language?
Yes it is possible (but not much fun)
Service Broker is configured and used via T-SQL commands, so if you have a way to talk to SQL Server from python (e.g. using the excellent pyodbc) then you just have to connect and issue the appropriate queries. Figuring out the appropriate T-SQL and getting Service Broker to work for you is the hard part, not the python bit.
import pyodbc
conn = pyodbc.connect(your_connection_string)
conn.autocommit = True
conn.execute("ALTER DATABASE CURRENT SET NEW_BROKER WITH ROLLBACK IMMEDIATE")
# ... etc ...
The rest of the (many hundreds of lines of) SQL is an exercise in understanding Service Broker, for which there is much MSDN documentation, such as the Developer's Guide for SQL Server 2008 R2.
The community tutorials are very useful for figuring out stuff that Microsoft doesn't tell you e.g. these which I found helpful enough to get a proof-of-concept running before I gave it up :)
http://rusanu.com/2006/04/06/fire-and-forget-good-for-the-military-but-not-for-service-broker-conversations/
http://www.davewentzel.com/content/service-broker-demystified-fire-and-forget-anti-pattern
http://www.davewentzel.com/content/service-broker-demystified-default-not-default
Related
I am trying to make ARX connect to a SQL Server database with hostname\instance and Windows auth. ARX keeps reporting "Unknown server host name". I need input for what ARX expects in "Server" when there is also an instance name.
The reason for looking at ARX, is because I am searching for a tool, which is capable of anonymizing a SQL Server database.
Connect to a SQL Server database, import the data and pattern, anonymize the data, overwrite the data in the database with the anonymized data.
Author of ARX here. Some feedback:
ARX is relased in two forms: a Java programming library as well
as a GUI. There is more flexibility when using the programming
library than with the GUI. You will be able to (in theory)
import the data from a SQL Server DBMS, but you will not be able to
write data back to the DBMS. This functionality is easy to implement using the library,
however.
We have been struggling with DBMS connection problems for quite some time. The reason is that we don't have that many different types of DBMSs around to be able to test wide range of possible connection settings. For example, I don't have SQL Server installation around, so I cannot investigate your problem.
That said, please report this issue on our GitHub issue tracker (https://github.com/arx-deidentifier/arx/issues). If you are able to run ARX from source, we would be happy to help to debug your problem. An issue requesting an export feature to DBMSs has already been created (https://github.com/arx-deidentifier/arx/issues/332). If you want, you can upvote it by commenting.
I want to use mysql proxy for processing queries trying to execute. I want to make this process available for all databases like mysql, ms sql server, oracle and ...
is it possible to use mysql proxy as base engine and connect these database from that? if no, is it possible to do this by making some little changes to mysql proxy source code?
You could use the standard external stored procedure support in the DBMS, but it would be difficult to map arbitrary queries to something meaningful.
Your are likely to be more successful implementing a lightweight parser as described in MySQL Client/Server Protocol and What communication protocol uses MySQL?.
Your preference that this can be done with 'some little changes' is likely not to be realistic. Expect a major job of the scale of ODBC to implement a generic SQL dialect translator.
I found that i have to use other exisiting proxies and change them in order to get what I need
I am completely ignorant in relation to databases and servers etc. Please bear with me.
I am trying to install a program called RealProspect 2009 which allows both local and remote sql database installation. Both types are done using the program installation .exe.
I have an azure account on which I have set up a server, and a database. During the program installation I am asked to provide the SQL server address, SQL server name, SQL username and SQL password. Using the information provided in the Azure online tools, I input all of this information into the fields and the program commences installing the database on the remote location. If I use incorrect information in these fields the installation returns an error and tells me it cannot log in, or the IP is not allowed etc., so I know it's actually attempting to connect and verifying the connection credentials.
When I use the correct server and login information the program proceeds. It spends several minutes "Creating the Tables". When it finishes doing that it attempts to begin "Installing Default Data (Categories)". At this point the program stops and I get the error in the subject line of this post "Invalid Object name 'Categories' "
I don't know enough to tell you what I don't know about this process.
I just signed up for Azure specifically because hosting the database with Azure is like $5-10 per month and I want myself and several other participants to be able to use the software with a common database. I created the server and database using the gui "tools/how to" from within the online Azure portal and I have never written a script, or accessed the server/database using anything other than the online GUI.
Thank you in advance for any help you may be able to provide. I hope i'm not too much of a speed bump to your day.
P.S. - For what it's worth you can download a free trial of the software from realinvestorsoftware.com and see if you could install it on a remote server. Maybe you can better see what I see and tell me how to do it on my own?
SQL Azure is VERY similar to SQL Server but there are a few features that SQL Azure doesn't support. That said, I'd be surprised if the app's installer is using any of the features that are unsupported by SQL Azure. My guess is that there's a bug in their installation scripts that might fail on more modern versions of SQL Server (note, their app installs on SQL Express 2005 which is no longer in mainstream support).
Just a couple of other thoughts for you: You get keys to install the app on two machines but:
"If you would like to install on more than two computers, then after you order your copy of RealProspect you can login to your customer account on this website and order additional activation keys for only $97 each."
Because you're going to be paying several hundred dollars anyway, and because (you yourself admit) you're not a database expert, it may be less cost, stress and hard-work to use their $27 per month database hosting service. That way you can concentrate on building your business while they take care of the technology.
[Update: 3/27/2013 # 23:05]
Another option Chris presented was to install the app and database locally and then migrate the database to Azure.
While this is potentially feasible, it requires some finesse to execute.
Microsoft provides a DB migration guide presenting several (pretty manual) options.
You might also want to read this thread which discusses how to migrate your DB via a DACPack.
Another option is to download and use the SQL Azure Migration Wizard which should do most of the heavy-lifting for you and make your DB migration simpler.
However, note that it is possible that the DB the app uses may use features of SQL Server that are not supported on SQL Azure. Hopefully this isn't the case, but be aware that this may be an issue.
Good luck :)
Chris,
I think SQL Database Migration Wizard v3.9.10 & v4.0.13 will solve your problem, I have used this tool several time to migrate db from local machine to sql azure, the most beauty of this tool it also highlights the error or sql which couldn't be migrated to Azure, so we can easily find alternate syntax of such sql queries
I have a need to make a remote connection through a DSL line (getting about 16k/s) to a SQL Express 2005 instance much faster.
I think I can do it by having a SQL Express 2005 instance on the client's local machine and have it be a cached version of the data on the server.
I'm planning to allow changes to the remote server only and then require the user pull down updates from it occasionally. It's not ideal, but it'll work.
So, does SQL Express support me querying across the network something like:
INSERT INTO local.dbo.users (id, username, email, timestamp_modified)
SELECT remote.dbo.users(id, username, email, timestamp_modified)
WHERE remote.dbo.users.timestamp_modified > LAST MODIFIED
For one you can use real Replication. You should also look into Service Broker. Both allow you to push the data from remote to a SQL Express instance. Service Broker performs and scales much better, is proven to work over slow DSL connections, but has a steep learning curve. Replicaiton is easy to set up but you'll have to live with it's limitations.
Using linked servers like you plan is not going to work. Is unreliable, slow, and doing updates over a linked server requires you to set up distributed transaction.
Why write something that has already been built and is available to you with the product you already have installed?
You should look into Log Shipping over your DSL line. It is a very reliable SQL Server product and has been tested extensively.
http://msdn.microsoft.com/en-us/library/ms187103.aspx
Although the express edition does not have SQL Server Agent, there are workarounds that you can use:
http://blog.willbeattie.net/2009/07/log-shipping-in-sql-server-express-2008.html
Hello,
I'm new here, so sorry, if my question is too basic. However, maybe you have some advice, example, links, which could help me... I'm trying to find something helpfull for few days, but no results as for now.
I'm working in a distributed environment. I have a Oracle server hundreds of miles away and a MS SQL server close to me. I'm writing a application using Visual Web Developer 2008 Express. I need some data from Oracle. It's not worth to query the Oracle server every time i need some data from it. I'd prefer to run some Oracle queries once each night and store results in some local (SQL Server) tables. I assume, I should run queries through standard windows scheduler (Windows Server 2008). I have the basic connectivity - I can open Oracle Database from local Visual Studio.
The questions are:
How to write a query/procedure/function that would get data from Oracle and put them into a SQL Server table (possibly recreated before each query run)?
How can I run such a query from command line (or in other way run from scheduler)
What naming conventions are applicable? In VS I use something like //IP.IP.IP.IP/Name and a user with password.
Thanks for any help or advice.
Regards,
Matteo
I suggest you speak to the DBA's of the Oracle and SQL Server databases, as there may be other considerations you need to bear in mind. (Data Integrity, Security, ownership etc.)
One route you could follow would be to implement DTS (For older databases) or SSIS (for new versions of SQL Server) processes to copy the data across on the schedule you want. (This is pretty much what they were built for.)
How much data are we talking about?
If there is a small quantity that you need to transfer every day, you can write a stupid fetch and insert script in language of your choice.
You only need to search for better solutions if "sync" would take too much resources.
Thanks...
I'm the DBA for the SQL Server, which will serve only for my application. For Oracle I just want to read data and I have enough privileges and agreement with DBA's. Security, ownership and integrity are not an issue for now. I just need some technical advise how to get data from Oracle to MSSQL tables on a schedule.
I use MS SQL Server 2008 Express SP1. I'm very close to solve my problem - I have established connections and everything installed and working. I just don't know, how to run a query, which would get data from Oracle and put into MSSQL, on regular basis, without manual interaction.
I've some experience in programming, but not much in databases (except creating complex SQl queries). Therefore some example or links to detailed description would be helpful. I'm not sure about naming conventions, differences between procedures, functions and queries, command line options to run db automation procedures and so on. I'm also not sure, about which mechanisms or technologies are available in MS SQL Server 2008 Express edition.