Back From UK Vacation

For the past ten days, we have been travelling around U.K. with some great friends (Skip and Sharon) from Columbia, South Carolina. Astoundingly, the weather was just great the whole time, apart from one day when driving in the very North of England. That day we had periods of light and heavy rain.

The scenery around the Lakes District and North was fabulous. We had a fill of Castles and Churches and Ruins and Gardens.

The worst feature of the whole trip was the airport security checks. These are a farce.

Once I find and unpack my camera, I will post a few photos (or at least some links) here.

John Griffiths

Terabyte is Here

A few weeks ago I ordered an external USB 1 Tb hard drive. This was to replace a 250Gb drive that I use for one of my backup regimes.

It costs less than US$90 and seems a little quicker than my older 250Gb USB drive. This is probably because it is 7,200 RPM in lieu of 5,400 RPM. And I think it has more internal cache memory.

I did not really need the extra room, but perhaps I will one day… The price was right, so why not have more free space available for backups.

Specs of the new drive are: SimpleDrive 1Tb Hitachi HDD.

Backups

Whilst on the subject of backups – I have recently trialed a few simple backup tools that let me schedule backups to remote FTP sites. I like “Backup4All-Pro”

If you are looking for off-site backup space, you may look at DriveHQ

John

Birthday Party

Today we had a birthday party for my 4 year old grand daughter.

wow2

 

We had a bouncy-castle delivered this morning and the guests had a ton of fun jumping for hours. I think they all went home worn out!

castle1

Executing SQL directly; no cursor

I was doing some extensive software testing in a program that talks to a MS-SQL2005 database. I detected that a table INSERT/UPDATE Trigger was seemingly not firing.

I scrutinised the trigger code and could see nothing wrong, and know that it has been functioning well for several years in other applications, using both MSSQL2000 and MSSQL2005.

So what was different in this program? I searched the web and did not find an answer.

I added some code to a test program to work around the issue. That is when I started catching this error message:

No Cursor Error

Here I was trying to CALL a stored procedure to update some balances. Again, the stored procedure has been working great for many years with no change. So, what was this message all about? Back to the web again and still no resolution.

That is when I dug deeper and added some more tests into a couple of other test programs I wrote, each of which tried different approaches to see what was really happening.

Strangely, some tested OK with no errors, and others threw the same error! So, what was the difference?

The Answer

The original error it seems is caught by the SQL Native Client ( or perhaps Microsoft Data Access Components (MDAC) ) and translated for the ODBC file drivers I was using. A translation (or miss-translation) is performed and a meaningless message is captured by the ODBC based drivers and passed back to my program as “Executing SQL directly; no cursor”.

Comparing the test programs I was working with pointed me to the answer. It was all to do with permissions! Nothing about “Executing SQL directly; no cursor”.

I found in some programs where I was using Application Role permissions to access the backend SQL, that the Application Role I was using did not have EXECUTE permission on the stored procedure.

Back into MS SQL Server Management Studio I went, and ran this command:

GRANT EXECUTE ON [dbo].[jg_AllBalances11] TO [LMGaus]

Now all my test programs began behaving as expected.

Also, my TRIGGER began working. The trigger was calling the stored procedure to do some of its work, and so now it too performed as expected.

Next time you see the

Executing SQL directly; no cursor

error, check all your permissions!

Hope this helps someone.

John Griffiths

The DAKAR 2009

One of the things I enjoy after hours is keeping up with “The Dakar“. For the past fifteen years or so, I have thought that if I could afford it, I would charter a chopper and follow “The Dakar” across North Africa. The scenery shown on the TV coverage has been magnificent.

Last year I was very disappointed that the race was cancelled due to political turmoil in the race route countries.

But This year, the race organisers have made a very brave decision, to move the race, even to a new Continent!

What was North Africa is now South America, in particular, Argentina and Chile.

I have been following the race this year with much interest and (initially) doubt. But the route selected this year has amazed me thus far. It has made me want to visit Argentina and Chile to see some of the landscape with my own eyes. Just as I wanted to visit North Africa.

Valparaiso Chile looks very inviting! Who Knows?
I know that Qantas (my favourite airline) flies to Santago, which is close to the beautiful coastal city of Valparaiso. Perhaps one day ….

In the meantime, around here, life stops when the daily Dakar highlights are on TV. I even set an alarm so as not to miss the show!

Recommended viewing for Rev Heads!

John

Tools – SetupBuilder

OK! So you spend all day developing, tweaking a software solution for a customer. Then you find out the actual Windows environment that they are running under… This happened to me recently..

Client wanted/needed a change… In fact, they were having problems with .TPS file on a normally reliable network. They are based about 3000 miles away!

Continue reading

Venus in the Daytime

A few days ago I heard a report on the local radio that it was possible to see Venus in the daytime if you know where to look.

So two days ago, about an hour before sunset, we started looking for it.

The moon is in the late afternoon sky at present, and I knew that Venus should be nearby.

After about 3 minutes of scanning the region where Venus should appear, we did in fact see it. The sun was still shining. The moon was starting to brighten.

It was there again last evening, about 40 minutes before sunset, and again was visible in daylight.

John.

The Dreaded “Record Was Changed By Another Station”

The subject error message shows up sometimes when working with Clarion and SQL based data.

When working on a recent conversion project I received the message when testing. I had moved a database from .TPS files to a MS-SQL Server database.

I had seen this message many time before, when getting started with SQL and dealing with DateTime data fields. So, I knew exactly where to look this time. Looking through the table in question, I noticed that I had no DateTime fields in the table. So something else was causing the warning “Record Was Changed By Another Station”. But, as there were no other “Stations” active, I was now in search of the source of the message.

First thing I checked was the order of the fields in my Dictionary, and the order of the fields in the database. This should not cause the error, but who knows… This all checked out OK.

Next I checked the data types were aligned and this too was all OK.

That is when I noticed that I had a STRING field in my dictionary as STRING(12) and in the database it was declared as CHAR(16). Yep, I had deliberately made it wider when I designed the new table but I had forgotten to adjust my Dictionary. Once I adjusted my dictionary to match the database, and re-compiled. all worked as it should.

But why would it report the “Record Changed By Another Station” warning, and not some more relevant message? Probably because the Clarion SQL file driver was doing its job correctly, and comparing my initially saved file buffer (with the 12 bytes I hade in my string in my dictionary). Then, just as I go to save my changed to the database, the SQL File Driver re-reads the data from the database, this time not using my data declarations, but the data as defined in the SQL table. It then does a byte-by-byte compare with the saved buffer. They do no match, so the warning message is displayed.

Bottom line: Make sure your Clarion dictionary declarations match the database fields.

John.

Handy Response to Un-Appreciated Letter

Did you ever get a letter from someone that lit your fuse? A friend of mine recently did, and asked for my advice for a response.

I recalled a response that I heard many years ago when I worked in a bank..

The response:

=====================================================

Dear Sir,

I am sitting in the smallest room in the house and I have your letter before me.

reading on toilet

Soon it will be behind me.

Yours truly….

======================================

 

SQL Programming in Clarion

I have posted several hints for working with MS-SQL2005 and get many requests for more.

If you are working with SQL-2005 Express or Standard, and have a hint you would like published, then please let me know and I will add it to the site.

The site I post to is www.sqlkey.com/

John Griffiths