cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2441
Views
16
Helpful
7
Replies

AXL execute SQL update

Wes Schochet
Level 3
Level 3

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...

7 Replies 7

Sascha Monteiro
Level 6
Level 6

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

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).

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

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

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

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

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.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: