This part of the story is about how the method to move the data from the Main Server to the BackUp Server was developed. It is the part of the development that was the most fun. It certainly gave me the most excitement and satisfaction.

It consists of a number of easily idenifiable steps that are described below.


First, I created an Web Page that sits on the Main Server.

It is called getdatalog.asp and the script is shown below:-



<!--#include file="mailserver.asp"-->
<!--#include file="directory.asp"-->
<!--#include file="language.asp"-->
<!--#include file="contact_routines.asp"-->
<%



DBConDATA = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & dataLogBaseRoot & "datalog.mdb"
''Response.Write DBConDATA
''Response.End
set ConDATA = Server.CreateObject("ADODB.Connection")
ConDATA.Open DBConDATA


DBConDATAUP = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & dataLogBaseRoot & "datalog.mdb"
''Response.Write DBConDATAUP
''Response.End
set ConDATAUP = Server.CreateObject("ADODB.Connection")
ConDATAUP.Open DBConDATAUP

   SQLStrDATA = "SELECT * FROM datalog WHERE IsNull(send_started_date_time) ORDER BY unique_number"
   Set rsDATA = ConDATA.Execute( SQLStrDATA )
   if rsDATA.EOF or rsDATA.BOF then
      Response.Write "There are none"
      Response.End
   end if

   SQLStrDATA = "Update datalog SET send_started_date_time = #" & cNow & "# WHERE unique_number = " & rsDATA("unique_number")
   Set rsDATAUP = ConDATAUP.Execute( SQLStrDATA )

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Get DataLog</title>
</head>
<body>
<form name="thisForm">
<P>
<textarea cols="70" rows="5" name="update_string"><% =rsDATA("update_string") %></textarea>
<BR>
<input type="text" name="unique_number" size="70" value="<% =rsDATA("unique_number") %>">
<BR>
<input type="text" name="program_name" size="70" value="<% =rsDATA("program_name") %>">
<BR>
<input type="text" name="trans_block_ref" size="70" value="<% =rsDATA("trans_block_ref") %>">
<BR>
<input type="text" name="trans_date_time" size="70" value="<% =rsDATA("trans_date_time") %>">
<BR>
<input type="text" name="connection_string" size="70" value="<% =rsDATA("connection_string") %>">
<BR>
<input type="text" name="start_trans" size="70" value="<% =rsDATA("start_trans") %>">
<BR>
<input type="text" name="end_trans" size="70" value="<% =rsDATA("end_trans") %>">
<BR>
</form>


<SCRIPT LANGUAGE="Javascript">

document.thisForm.submit();
</script>


</body>
</html>


   		

This gets and displays the contents of the first 'UnTransfered' entry in the database table on the Master Server'

It is run in a Browser on the BackUp Server.



Next I added a 'Submit' button and an 'Action' to the page





<!--#include file="mailserver.asp"-->
<!--#include file="directory.asp"-->
<!--#include file="language.asp"-->
<!--#include file="contact_routines.asp"-->
<%



DBConDATA = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & dataLogBaseRoot & "datalog.mdb"
''Response.Write DBConDATA
''Response.End
set ConDATA = Server.CreateObject("ADODB.Connection")
ConDATA.Open DBConDATA


DBConDATAUP = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & dataLogBaseRoot & "datalog.mdb"
''Response.Write DBConDATAUP
''Response.End
set ConDATAUP = Server.CreateObject("ADODB.Connection")
ConDATAUP.Open DBConDATAUP

   SQLStrDATA = "SELECT * FROM datalog WHERE IsNull(send_started_date_time) ORDER BY unique_number"
   Set rsDATA = ConDATA.Execute( SQLStrDATA )
   if rsDATA.EOF or rsDATA.BOF then
      Response.Write "There are none"
      Response.End
   end if

   SQLStrDATA = "Update datalog SET send_started_date_time = #" & cNow & "# WHERE unique_number = " & rsDATA("unique_number")
   Set rsDATAUP = ConDATAUP.Execute( SQLStrDATA )

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Get DataLog</title>
</head>
<body>

<form name="thisForm" method="post" action="http://localhost/backupdata/saveDataLog.asp">

<P>
<textarea cols="70" rows="5" name="update_string"><% =rsDATA("update_string") %></textarea>
<BR>
<input type="text" name="unique_number" size="70" value="<% =rsDATA("unique_number") %>">
<BR>
<input type="text" name="program_name" size="70" value="<% =rsDATA("program_name") %>">
<BR>
<input type="text" name="trans_block_ref" size="70" value="<% =rsDATA("trans_block_ref") %>">
<BR>
<input type="text" name="trans_date_time" size="70" value="<% =rsDATA("trans_date_time") %>">
<BR>
<input type="text" name="connection_string" size="70" value="<% =rsDATA("connection_string") %>">
<BR>
<input type="text" name="start_trans" size="70" value="<% =rsDATA("start_trans") %>">
<BR>
<input type="text" name="end_trans" size="70" value="<% =rsDATA("end_trans") %>">
<BR>

<input type="submit" value="Save It">

</form>

</body>
</html>


		

This web page is run from a browser on the BackUp Server.

Now it was necessary to create a Web Page to store the data in the datalog on the Backup Server.


The page that does the storing of the data on the Backup Server is called saveDataLog.asp and the script is shown below



<!--#include file="directory.asp"-->
<!--#include file="dbconnections.asp"-->
<%

'''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''
'''                                           '''
'''                                           '''
'''  This file contains the routines for      '''
'''  recording the updates to data tables.    '''
'''                                           '''
'''                                           '''
'''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''



DBConDATA = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & dataLogBaseRoot & "datalog.mdb"
''Response.Write DBConDATA
''Response.End
set ConDATA = Server.CreateObject("ADODB.Connection")
ConDATA.Open DBConDATA


cNowDateStr = "%D %b %Y %H:%N:%S"
cNow = UCase(fncFmtDate(Now, cNowDateStr))





   cADTUS = Replace(Request.Form("update_string"), "'", "''")

   SQLStrDATA = "INSERT INTO datalog ("

   SQLStrDATA = SQLStrDATA & "update_string, "
   SQLStrDATA = SQLStrDATA & "start_trans, "
   SQLStrDATA = SQLStrDATA & "end_trans, "
   SQLStrDATA = SQLStrDATA & "trans_date_time, "
   SQLStrDATA = SQLStrDATA & "program_name, "
   SQLStrDATA = SQLStrDATA & "dataBaseRoot, "
   SQLStrDATA = SQLStrDATA & "trans_block_ref, "
   SQLStrDATA = SQLStrDATA & "original_unique_number, "
   SQLStrDATA = SQLStrDATA & "connection_string"

   SQLStrDATA = SQLStrDATA & ") values ("

   SQLStrDATA = SQLStrDATA & "'" & cADTUS & "', "
   SQLStrDATA = SQLStrDATA & " " & Request.Form("start_trans") & " , " 
   SQLStrDATA = SQLStrDATA & " " & Request.Form("end_trans") & " , " 
   SQLStrDATA = SQLStrDATA & "#" & Request.Form("trans_date_time") & "#, "
   SQLStrDATA = SQLStrDATA & "'" & Request.Form("program_name") & "', "
   SQLStrDATA = SQLStrDATA & "'" & dataBaseRoot & "', "
   SQLStrDATA = SQLStrDATA & " " & Request.Form("trans_block_ref") & " , "
   SQLStrDATA = SQLStrDATA & " " & Request.Form("unique_number") & " , "
   SQLStrDATA = SQLStrDATA & "'" & Request.Form("connection_string") & "')"

''Response.Write SQLStrDATA
''Response.End

   Set rsDATA = ConDATA.Execute( SQLStrDATA )




%>

Got it



		

That then has got the data into the database table on the BackUp Server.


Now I need to get the message back to the Main Server that the data has been stored on the BackUp Server. So I added a couple of lines into the saveDataLog.asp script.



<!--#include file="directory.asp"-->
<!--#include file="dbconnections.asp"-->
<%

'''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''
'''                                           '''
'''                                           '''
'''  This file contains the routines for      '''
'''  recording the updates to data tables.    '''
'''                                           '''
'''                                           '''
'''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''



DBConDATA = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & dataLogBaseRoot & "datalog.mdb"
''Response.Write DBConDATA
''Response.End
set ConDATA = Server.CreateObject("ADODB.Connection")
ConDATA.Open DBConDATA


cNowDateStr = "%D %b %Y %H:%N:%S"
cNow = UCase(fncFmtDate(Now, cNowDateStr))





   cADTUS = Replace(Request.Form("update_string"), "'", "''")

   SQLStrDATA = "INSERT INTO datalog ("

   SQLStrDATA = SQLStrDATA & "update_string, "
   SQLStrDATA = SQLStrDATA & "start_trans, "
   SQLStrDATA = SQLStrDATA & "end_trans, "
   SQLStrDATA = SQLStrDATA & "trans_date_time, "
   SQLStrDATA = SQLStrDATA & "program_name, "
   SQLStrDATA = SQLStrDATA & "dataBaseRoot, "
   SQLStrDATA = SQLStrDATA & "trans_block_ref, "
   SQLStrDATA = SQLStrDATA & "original_unique_number, "
   SQLStrDATA = SQLStrDATA & "connection_string"

   SQLStrDATA = SQLStrDATA & ") values ("

   SQLStrDATA = SQLStrDATA & "'" & cADTUS & "', "
   SQLStrDATA = SQLStrDATA & " " & Request.Form("start_trans") & " , " 
   SQLStrDATA = SQLStrDATA & " " & Request.Form("end_trans") & " , " 
   SQLStrDATA = SQLStrDATA & "#" & Request.Form("trans_date_time") & "#, "
   SQLStrDATA = SQLStrDATA & "'" & Request.Form("program_name") & "', "
   SQLStrDATA = SQLStrDATA & "'" & dataBaseRoot & "', "
   SQLStrDATA = SQLStrDATA & " " & Request.Form("trans_block_ref") & " , "
   SQLStrDATA = SQLStrDATA & " " & Request.Form("unique_number") & " , "
   SQLStrDATA = SQLStrDATA & "'" & Request.Form("connection_string") & "')"

''Response.Write SQLStrDATA
''Response.End

   Set rsDATA = ConDATA.Execute( SQLStrDATA )



cRespStr = "http://www.MainServer.co/confirmDataGot.asp?un=" & Request.Form("unique_number")

Response.Redirect cRespStr





%>

Got it



		

So now what I need is a page on the Main Server to record it.


The file to run on the Main Server is called confirmDataGot.asp and the script is shown below.


<!--#include file="mailserver.asp"-->
<!--#include file="directory.asp"-->
<!--#include file="language.asp"-->
<!--#include file="contact_routines.asp"-->
<%



DBConDATA = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & dataLogBaseRoot & "datalog.mdb"
''Response.Write DBConDATA
''Response.End
set ConDATA = Server.CreateObject("ADODB.Connection")
ConDATA.Open DBConDATA


DBConDATAUP = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & dataLogBaseRoot & "datalog.mdb"
''Response.Write DBConDATAUP
''Response.End
set ConDATAUP = Server.CreateObject("ADODB.Connection")
ConDATAUP.Open DBConDATAUP

   SQLStrDATA = "Update datalog SET send_done_date_time = #" & cNow & "# WHERE unique_number = " & Request.QueryString("un")
   Set rsDATAUP = ConDATAUP.Execute( SQLStrDATA )

   SQLStrDATA = "Update datalog SET send_done = True WHERE unique_number = " & Request.QueryString("un")
   Set rsDATAUP = ConDATAUP.Execute( SQLStrDATA )

Response.Redirect "http://www.MainServer.co/getDataLog.asp"


%>

OK - Confirmed

		

You will notice that when the confirmation is recorded, control is redirected to getDataLog.asp so the cycle starts again !!


Although there is a certain theraputic quality in sitting at the BackUp Server clicking on the 'Submit' button and seeing the updates going on, the novelty soon wears off !!

So I very slight change was made to the getdatalog.asp script. It is shown below.





<!--#include file="mailserver.asp"-->
<!--#include file="directory.asp"-->
<!--#include file="language.asp"-->
<!--#include file="contact_routines.asp"-->
<%



DBConDATA = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & dataLogBaseRoot & "datalog.mdb"
''Response.Write DBConDATA
''Response.End
set ConDATA = Server.CreateObject("ADODB.Connection")
ConDATA.Open DBConDATA


DBConDATAUP = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & dataLogBaseRoot & "datalog.mdb"
''Response.Write DBConDATAUP
''Response.End
set ConDATAUP = Server.CreateObject("ADODB.Connection")
ConDATAUP.Open DBConDATAUP

   SQLStrDATA = "SELECT * FROM datalog WHERE IsNull(send_started_date_time) ORDER BY unique_number"
   Set rsDATA = ConDATA.Execute( SQLStrDATA )
   if rsDATA.EOF or rsDATA.BOF then
      Response.Write "There are none"
      Response.End
   end if

   SQLStrDATA = "Update datalog SET send_started_date_time = #" & cNow & "# WHERE unique_number = " & rsDATA("unique_number")
   Set rsDATAUP = ConDATAUP.Execute( SQLStrDATA )

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Get DataLog</title>
</head>
<body>

<form name="thisForm" method="post" action="http://localhost/backupdata/saveDataLog.asp">

<P>
<textarea cols="70" rows="5" name="update_string"><% =rsDATA("update_string") %></textarea>
<BR>
<input type="text" name="unique_number" size="70" value="<% =rsDATA("unique_number") %>">
<BR>
<input type="text" name="program_name" size="70" value="<% =rsDATA("program_name") %>">
<BR>
<input type="text" name="trans_block_ref" size="70" value="<% =rsDATA("trans_block_ref") %>">
<BR>
<input type="text" name="trans_date_time" size="70" value="<% =rsDATA("trans_date_time") %>">
<BR>
<input type="text" name="connection_string" size="70" value="<% =rsDATA("connection_string") %>">
<BR>
<input type="text" name="start_trans" size="70" value="<% =rsDATA("start_trans") %>">
<BR>
<input type="text" name="end_trans" size="70" value="<% =rsDATA("end_trans") %>">
<BR>

<input type="submit" value="Save It">

</form>



<SCRIPT LANGUAGE="Javascript">

document.thisForm.submit();
</script>



</body>
</html>


		

This automatic Submission process makes it go round and round - now watching that is really inspiring !!


This page describes how the moving process was developed. It was used for about seven days before it was developed some more.

BUT

The real 'Production Process' uses a permanently running VBS file. It goes round the moving process loop until it hits the end. When it gets to the end, it 'Sleeps' for sixty seconds and then tries again.

It does not have to be a VBS file - it could be (say) a Visual dBase (or any other type of) .EXE file. VBS was chosen because it allowed the VBS script (already proven in the ASP files) to be re-used.


That concludes this page about moving (or to be more precise Copying) the Data Update details from the Main to BackUp Server.


In the past, I have written such stories on one web page. One of the readers printed one out on paper - the paper was over fifty foot long. This time, Im using several pages to make it easier for readers to deal with. This page is just an Introduction to set the scene.

An index and links to the other pages is given below.