AXL execute SQL update

Unanswered Question
Oct 17th, 2008
User Badges:

Is there a way to fire off an update query like:

Update devices set description = 'A' where description = 'B'


I get a "no update permission" error.


Yes, this a bad idea for many reasons, but I'm not willing to let that stop me, at least in this lab/test scenario...

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 3 (2 ratings)
Loading.
Sascha Monteiro Sun, 10/19/2008 - 17:37
User Badges:
  • Silver, 250 points or more

you probably don't have correct credentials,

have you tried through CLI?

(and tried using device instead of devices (the s)

admin:run sql update device set description='test' where description='SEP00xxxxxxxxxx'

Rows: 1


stephan.steiner Mon, 10/20/2008 - 04:43
User Badges:
  • Silver, 250 points or more

Hmm... could be a bug since it's supposed to tell you that the table devices does not exist.


And there are no different levels of axl access.. if your user has axl access (and thus can send sql queries for instance) the update commands must work (unless you try to do something that would violate the db constraints.. in that case you'll get an error from the database layer telling you what you're trying to do is not permitted).

Wes Schochet Mon, 10/20/2008 - 06:59
User Badges:

Thanks for the response Stephan and s. Sorry - the original post had a typo. I was using the proper table name.


I didn't realize that there was a command line option. I've been avoiding the command line because I don't know too much about it. The command line option worked:


admin:run sql update device set description= "Test" where name="SEP000000032081"

Rows: 1

admin:


Of course this morning, I get something totally different from AXL (but these are the actual reuest and response envelopes):


sent:

http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

update device set description= 'Test' where name='SEP001BD458B533'



received:

http://schemas.xmlsoap.org/soap/envelope/"

SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">



SOAP-ENV:Client

Method only for queries

http://www.cisco.com/AXL/API/1.0">

-79750

Method only for queries

executeSQLQuery





Wes Schochet Mon, 10/20/2008 - 08:57
User Badges:

Hmmm…. The plot thickens. I received an eval phone that I was trying to set up. I was trying to update the tkModel field to the appropriate value so that the phone registration would not be rejected. Apparently update permissions are set on a field by field basis - unless I am missing some referential integrity issue here.


SO, this query works:

admin:run sql update Device set Description="Wes 7 9 2 5" where name = "SEP002290EA9F61"

Rows: 1


But this one does not work:

admin:run sql update Device set tkModel=484 where name = "SEP002290EA9F61"

No UPDATE permission.


Ironically, when I look at the type model table, there is an entry, but it's obviously "turned off". Guess I'll have to try and track down a patch or see what I need to turn it on!

admin:run sql select * from TypeProduct where enum=371

enum name moniker tkmodel maxports showindropdown devicenameformat isinstalleddefault devicenamestring

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

371 Cisco 7925 PRODUCT_CISCO_7925 484 0 f ([sS][eE][pP]|BAT)[0-9a-fA-F]{12} f SEP[mac]

a


Sascha Monteiro Mon, 10/20/2008 - 11:41
User Badges:
  • Silver, 250 points or more

in axl you need to use executeSQLUpdate (insted of Query)


and you can never change the model of a phone, you need to delete it, and recreate it with the correct type


hth

Wes Schochet Mon, 10/20/2008 - 11:58
User Badges:

Ahhh - it was the executeSQLUpdate that was throwing me...

stephan.steiner Tue, 10/21/2008 - 04:22
User Badges:
  • Silver, 250 points or more

hmm... the error is still weird though.. axl is supposed to tell you that you cannot make updates with executeSQLQuery... at least I recall it telling me so.

Actions

This Discussion