I have the following problem:
I have 2 MySql DBs on 2 different servers with a single table, each with same table structure. These DBs tables have a number of BLOB fields in each record (voice recordings in WAV format), plus a numeric record id.
I am using classic ASP (VB) and can not change since the whole sistem is in classic asp (furthermore I do not know another language/system yet). I know it's old but now need to solve this problem.
I need to read a certain record from DB1 (let's say record with IdNum=100), with full data (including BLOB fields) ... and save (insert) the same full record in table of DB2 (including the BLOB fields).
I tried normal insert but get a "type mismatch" error in the sqlRec2 declaration line.
Anybody can help me about how to do this ?? THANKS !!
My code is below (recwav01, 02 and 03 are BLOB fields, "notes" is txt field):
Set my_conn = createobject("ADODB.Connection")
Set my_conn2 = createobject("ADODB.Connection")
my_conn.open = "DRIVER={MySQL ODBC 5.3 Unicode Driver};"_
& "SERVER=yyy.yyy.yyy.yyy;PORT=3306;"_
& "DATABASE=dbremote01;"_
& "UID=root;PWD=password01; OPTION=35;"
my_conn2.open = "DRIVER={MySQL ODBC 5.3 Unicode Driver};"_
& "SERVER=xxx.xxx.xxx.xxx;PORT=3306;"_
& "DATABASE=dbremote02;"_
& "UID=root;PWD=password02; OPTION=35;"
sqlRec = "SELECT * FROM table01 WHERE idnum>=100 AND idnum <=120;"
Set rs = my_conn.Execute(sqlRec)
DO WHILE NOT rs.EOF
sqlRec2 = "INSERT INTO table02 (idnum,notes,recwav01,recwav02,recwav03) VALUES (" & _
rs("idnum") & ", '" & rs("notes") & "', '" & rs("recwav01") & "', '" & rs("recwav02") & _
"', '" & rs("recwav03") & "');"
my_conn2.Execute(sqlRec2)
rs.movenext
LOOP