472,958 Members | 2,508 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

Write from MS SQL to MySQL

I have a MS sql 2000 db that needs to sync with a Mysql db.

When a password is changed in the MS SQL table, I need to make sure
that the same value is updated in the Mysql db.

I dont have any control of the gui that is initiating this event. So,
I was thinking a trigger might be an alternate route.

I just dont know how to get the username and password values that have
just been updated from MS sql to Mysql.

I do understand how to build the sql statements for both sides, but
this has to be automated and fire real time.

example:
if username "joe" just changed thier password to "pass" then I need to
fire a query, event, function, whatever, that will update the password
field in the Mysql table where the username is "joe" to "pass".

Any ideas or samples would be greatly apperciated.
Jul 20 '05 #1
4 5814
Dave (fu*****@yahoo.com) writes:
I have a MS sql 2000 db that needs to sync with a Mysql db.

When a password is changed in the MS SQL table, I need to make sure
that the same value is updated in the Mysql db.

I dont have any control of the gui that is initiating this event. So,
I was thinking a trigger might be an alternate route.

I just dont know how to get the username and password values that have
just been updated from MS sql to Mysql.

I do understand how to build the sql statements for both sides, but
this has to be automated and fire real time.

example:
if username "joe" just changed thier password to "pass" then I need to
fire a query, event, function, whatever, that will update the password
field in the Mysql table where the username is "joe" to "pass".

Any ideas or samples would be greatly apperciated.


A presumption for this to work, is that there is an OLE DB provider
that can talk to MySQL. I would not expect there there is an targeted
provider, but if there is an ODBC driver, then you can use MSDASQL,
OLEDB over ODBC.

If it's only a single value that you need to replicate, a trigger
that updates a table on a linked server would be the way to go. You
set up the linked server with sp_addlinkedserver, see Books Online
for details. You can also do it from Enterprise Manager. In the trigger
you would say:

UPDATE MYSQL.db.schema.tbl
SET password = i.password
FROM inserted i
JOIN MYSQL.db.schema.tbl m ON i.userid = m.userid

If there are plnetyful of tables you need to replicate, you should
probably look into replication.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2
Erland,

Thanks for responding to my post. It appears there isnt too much help
out here regarding what I need to do.

I have created the linked server in ms sql, and I can see the table in
Enterprise manager just fine. However when I try to run the following
query from ms query analyzer I cant get results, only errors.

("Editor" is the name of my mysql dsn)
("test" is the name of the mysql database)
("userinfo" is the name of my table in mysql)

SELECT * FROM OPENQUERY(Editor, 'SELECT * FROM userinfo')

Server: Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'MSDASQL' reported an error.
[OLE/DB provider returned message: [MySQL][ODBC 3.51
Driver][mysqld-3.23.58]Table 'test.userinfo' doesn't exist]
OLE DB error trace [OLE/DB Provider 'MSDASQL'
IColumnsInfo::GetColumnsInfo returned 0x80004005: ].

Any ideas on this one....

Thanks again,
Dave


Erland Sommarskog <es****@sommarskog.se> wrote in message news:<Xn**********************@127.0.0.1>...
Dave (fu*****@yahoo.com

) writes:
I have a MS sql 2000 db that needs to sync with a Mysql db.

When a password is changed in the MS SQL table, I need to make sure
that the same value is updated in the Mysql db.

I dont have any control of the gui that is initiating this event. So,
I was thinking a trigger might be an alternate route.

I just dont know how to get the username and password values that have
just been updated from MS sql to Mysql.

I do understand how to build the sql statements for both sides, but
this has to be automated and fire real time.

example:
if username "joe" just changed thier password to "pass" then I need to
fire a query, event, function, whatever, that will update the password
field in the Mysql table where the username is "joe" to "pass".

Any ideas or samples would be greatly apperciated.


A presumption for this to work, is that there is an OLE DB provider
that can talk to MySQL. I would not expect there there is an targeted
provider, but if there is an ODBC driver, then you can use MSDASQL,
OLEDB over ODBC.

If it's only a single value that you need to replicate, a trigger
that updates a table on a linked server would be the way to go. You
set up the linked server with sp_addlinkedserver, see Books Online
for details. You can also do it from Enterprise Manager. In the trigger
you would say:

UPDATE MYSQL.db.schema.tbl
SET password = i.password
FROM inserted i
JOIN MYSQL.db.schema.tbl m ON i.userid = m.userid

If there are plnetyful of tables you need to replicate, you should
probably look into replication.

Jul 20 '05 #3
Dave (fu*****@yahoo.com) writes:
Thanks for responding to my post. It appears there isnt too much help
out here regarding what I need to do.

I have created the linked server in ms sql, and I can see the table in
Enterprise manager just fine. However when I try to run the following
query from ms query analyzer I cant get results, only errors.

("Editor" is the name of my mysql dsn)
("test" is the name of the mysql database)
("userinfo" is the name of my table in mysql)

SELECT * FROM OPENQUERY(Editor, 'SELECT * FROM userinfo')

Server: Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'MSDASQL' reported an error.
[OLE/DB provider returned message: [MySQL][ODBC 3.51
Driver][mysqld-3.23.58]Table 'test.userinfo' doesn't exist]
OLE DB error trace [OLE/DB Provider 'MSDASQL'
IColumnsInfo::GetColumnsInfo returned 0x80004005: ].

Any ideas on this one....


I don't know about MySQL, but the normal scheme is a three-part notation:
catalog.schema.table, as defined by ANSI. So when MySQL says that it
cannot find test.userinfo that makes me believe it's looking in schema
called test, not a database called test. But that is only my prejudice.

If you run the command with full qualification from a MySQL query tool,
how would you write?

How does your sp_addlinkedserver command with which you defined the
server look like?

Have your tried a MySQL forum?

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #4
A good migration tool - Navicat can do the trick.

It enables migrating access to mysql, excel to mysql and ms sql to mysql.

Please download a trial version here: http://www.navicat.com/download.php3
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tanamon | last post by:
Hello All, I am a MySQL newbie trying to write a query that selects file_name records possessing the highest numbered version for that unique file_name. I show sample data and two trial queries...
1
by: Pratchaya | last post by:
Hi, All Can i write php code to connect 2 MySQL DB. like this case. ? My Environment : Server < ---- > PC Client Server =
2
by: bballr | last post by:
I have a problem that I'm not sure if it can be done. I'm trying to use the MySQL C API to be able to use a normal sql insert statement that will send the data or file to a directory and NOT the...
9
by: asenthil | last post by:
Hai to all,, i had to tried to retrive and write a single row to a file from the database.. But dont know to write all the retrived rows to a file from the database.. how to do that... ...
20
by: _mario.lat | last post by:
hallo, I use PHP and I'd like to not write in hardcoded way password and login to access to mysql. how to not write password in code for access to mysql? How can I do? I'd like that who see my...
0
by: musosmiffy | last post by:
Hi, I have been trying to get the following working for days - I wonder if anyone could help me? I am trying to list a set of database entries as a newspaper column. I am using classic ASP (not...
4
by: Ross | last post by:
Hello, I am trying to Read and Write to a text file on a web server using Microsoft Visual Basic 2005 Express Edition. So far I have managed to complete my testing with a local text file using...
3
by: RAG2007 | last post by:
Hi, I'm creating a backend for my Access front end in MySQL, and am running tests. I am coming across the infamous "Write Error". Here's an instance: I open a form with a subform, and when I...
3
by: shivapadma | last post by:
1. i want to write a stored procedure using mysql 5.0.45 version. 2. when i tried with the following code ,i am unable to write mysql->delimeter// ->create procedure proc(out p1 int)...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.