# AdHoc Trend Template Error

**URL:** <https://forum.inductiveautomation.com/t/adhoc-trend-template-error/20349>\
**Category:** Ignition\
**Created:** [October 24, 2018, 3:47pm UTC](https://forum.inductiveautomation.com/t/adhoc-trend-template-error/20349 "2018-10-24T15:47:44Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![erikburns](https://avatars.discourse-cdn.com/v4/letter/e/e5b9ba/32.png) [@erikburns](https://forum.inductiveautomation.com/u/erikburns)\
**Post date:** [October 24, 2018, 3:47pm UTC](https://forum.inductiveautomation.com/t/adhoc-trend-template-error/20349/1 "2018-10-24T15:47:44Z")

</div>

I am trying to use the AdHoc Trend Template, and the existing script will not create the tables in my database. I get the following error.

```auto
  File "<event:actionPerformed>", line 17, in <module>
  File "<custom-function createTables>", line 18, in createTables
				[id] [int] IDENTITY(1,1) NOT NULL,
				[title] [nvarchar](50) NOT NULL,
				[tagpens] [nvarchar](max) NOT NULL,
				[axes] [nvarchar](max) NOT NULL,
				[username] [nvarchar](50) NULL,
				[lastmodified] [datetime] NOT NULL,
			 CONSTRAINT [PK_saved_graphs] PRIMARY KEY CLUSTERED 
			(
				[id] ASC
			)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
			) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY], [], , , false, false)

	at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:362)

	at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.runPrepUpdate(AbstractDBUtilities.java:258)

	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.lang.reflect.Method.invoke(Unknown Source)

java.lang.Exception: java.lang.Exception: Error executing system.db.runPrepUpdate(CREATE TABLE [dbo].[saved_graphs](
				[id] [int] IDENTITY(1,1) NOT NULL,
				[title] [nvarchar](50) NOT NULL,
				[tagpens] [nvarchar](max) NOT NULL,
				[axes] [nvarchar](max) NOT NULL,
				[username] [nvarchar](50) NULL,
				[lastmodified] [datetime] NOT NULL,
			 CONSTRAINT [PK_saved_graphs] PRIMARY KEY CLUSTERED 
			(
				[id] ASC
			)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
			) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY], [], , , false, false)

```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 24, 2018, 3:50pm UTC](https://forum.inductiveautomation.com/t/adhoc-trend-template-error/20349/2 "2018-10-24T15:50:21Z")

</div>

Can you copy the _full_ details of the error message? It’s getting cut off. When you paste it here, put it inside triple backticks to preserve formatting:

````
```
error message
```
````

---

<div class="post-metadata">

**Author:** ![erikburns](https://avatars.discourse-cdn.com/v4/letter/e/e5b9ba/32.png) [@erikburns](https://forum.inductiveautomation.com/u/erikburns)\
**Post date:** [October 24, 2018, 3:52pm UTC](https://forum.inductiveautomation.com/t/adhoc-trend-template-error/20349/3 "2018-10-24T15:52:45Z")

</div>

I didn't place the whole message originally...  
'''Traceback (most recent call last):  
 File "", line 17, in   
 File "", line 18, in createTables  
 [id] [int] IDENTITY(1,1) NOT NULL,  
 [title] [nvarchar](50) NOT NULL,  
 [tagpens] [nvarchar](max) NOT NULL,  
 [axes] [nvarchar](max) NOT NULL,  
 [username] [nvarchar](50) NULL,  
 [lastmodified] [datetime] NOT NULL,  
 CONSTRAINT [PK\_saved\_graphs] PRIMARY KEY CLUSTERED   
 (  
 [id] ASC  
 )WITH (PAD\_INDEX = OFF, STATISTICS\_NORECOMPUTE = OFF, IGNORE\_DUP\_KEY = OFF, ALLOW\_ROW\_LOCKS = ON, ALLOW\_PAGE\_LOCKS = ON) ON [PRIMARY]  
 ) ON [PRIMARY] TEXTIMAGE\_ON [PRIMARY], [], , , false, false)

```
at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:362)

at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.runPrepUpdate(AbstractDBUtilities.java:258)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)
```

java.lang.Exception: java.lang.Exception: Error executing system.db.runPrepUpdate(CREATE TABLE [dbo].[saved\_graphs](  
 [id] [int] IDENTITY(1,1) NOT NULL,  
 [title] [nvarchar](50) NOT NULL,  
 [tagpens] [nvarchar](max) NOT NULL,  
 [axes] [nvarchar](max) NOT NULL,  
 [username] [nvarchar](50) NULL,  
 [lastmodified] [datetime] NOT NULL,  
 CONSTRAINT [PK\_saved\_graphs] PRIMARY KEY CLUSTERED   
 (  
 [id] ASC  
 )WITH (PAD\_INDEX = OFF, STATISTICS\_NORECOMPUTE = OFF, IGNORE\_DUP\_KEY = OFF, ALLOW\_ROW\_LOCKS = ON, ALLOW\_PAGE\_LOCKS = ON) ON [PRIMARY]  
 ) ON [PRIMARY] TEXTIMAGE\_ON [PRIMARY], [], , , false, false)

```
at org.python.core.Py.JavaError(Py.java:495)
at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:362)
at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.runPrepUpdate(AbstractDBUtilities.java:258)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction. __call__ (PyReflectedFunction.java:186)
at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction. __call__ (ScriptManager.java:431)
at org.python.core.PyObject. __call__ (PyObject.java:422)
at org.python.core.PyObject. __call__ (PyObject.java:426)
at org.python.pycode._pyx1914.createTables$1(<custom-function createTables>:59)
at org.python.pycode._pyx1914.call_function(<custom-function createTables>)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyBaseCode.call(PyBaseCode.java:149)
at org.python.core.PyFunction. __call__ (PyFunction.java:327)
at org.python.core.PyMethod. __call__ (PyMethod.java:124)
at org.python.pycode._pyx1913.f$0(<event:actionPerformed>:48)
at org.python.pycode._pyx1913.call_function(<event:actionPerformed>)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1275)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:636)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:180)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:271)
at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:57)
at com.sun.proxy.$Proxy18.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
```

Caused by: java.lang.Exception: Error executing system.db.runPrepUpdate(CREATE TABLE [dbo].[saved\_graphs](  
 [id] [int] IDENTITY(1,1) NOT NULL,  
 [title] [nvarchar](50) NOT NULL,  
 [tagpens] [nvarchar](max) NOT NULL,  
 [axes] [nvarchar](max) NOT NULL,  
 [username] [nvarchar](50) NULL,  
 [lastmodified] [datetime] NOT NULL,  
 CONSTRAINT [PK\_saved\_graphs] PRIMARY KEY CLUSTERED   
 (  
 [id] ASC  
 )WITH (PAD\_INDEX = OFF, STATISTICS\_NORECOMPUTE = OFF, IGNORE\_DUP\_KEY = OFF, ALLOW\_ROW\_LOCKS = ON, ALLOW\_PAGE\_LOCKS = ON) ON [PRIMARY]  
 ) ON [PRIMARY] TEXTIMAGE\_ON [PRIMARY], [], , , false, false)  
 ... 63 more  
Caused by: com.inductiveautomation.ignition.client.gateway\_interface.GatewayException: Error executing function 'RunPrepStmt': The current user does not have the required roles for this operation.  
 at com.inductiveautomation.ignition.client.gateway\_interface.GatewayInterface.newGatewayException(GatewayInterface.java:341)  
 at com.inductiveautomation.ignition.client.gateway\_interface.GatewayInterface.sendMessage(GatewayInterface.java:315)  
 at com.inductiveautomation.ignition.client.gateway\_interface.GatewayInterface.sendMessage(GatewayInterface.java:268)  
 at com.inductiveautomation.ignition.client.script.ClientDBUtilities.\_runPrepStmt(ClientDBUtilities.java:215)  
 at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.runPrepUpdate(AbstractDBUtilities.java:256)  
 ... 61 more  
Caused by: com.inductiveautomation.ignition.gateway.servlets.gateway.functions.GatewayFunctionException: The current user does not have the required roles for this operation.  
 at com.inductiveautomation.ignition.gateway.servlets.Gateway.doPost(Gateway.java:403)  
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)  
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)  
 at com.inductiveautomation.ignition.gateway.bootstrap.MapServlet.service(MapServlet.java:85)  
 at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:837)  
 at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:583)  
 at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)  
 at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)  
 at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)  
 at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1160)  
 at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)  
 at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)  
 at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1092)  
 at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)  
 at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)  
 at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)  
 at org.eclipse.jetty.server.Server.handle(Server.java:518)  
 at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:308)  
 at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:244)  
 at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)  
 at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)  
 at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)  
 at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:246)  
 at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:156)  
 at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)  
 at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)  
 at java.lang.Thread.run(null)

Ignition v7.9.8 (b2018060714)  
Java: Oracle Corporation 1.8.0\_171  
'''

---

<div class="post-metadata">

**Author:** ![erikburns](https://avatars.discourse-cdn.com/v4/letter/e/e5b9ba/32.png) [@erikburns](https://forum.inductiveautomation.com/u/erikburns)\
**Post date:** [October 24, 2018, 3:54pm UTC](https://forum.inductiveautomation.com/t/adhoc-trend-template-error/20349/4 "2018-10-24T15:54:13Z")

</div>

'''  
Traceback (most recent call last):  
 File "", line 17, in   
 File "", line 18, in createTables  
 [id] [int] IDENTITY(1,1) NOT NULL,  
 [title] [nvarchar](50) NOT NULL,  
 [tagpens] [nvarchar](max) NOT NULL,  
 [axes] [nvarchar](max) NOT NULL,  
 [username] [nvarchar](50) NULL,  
 [lastmodified] [datetime] NOT NULL,  
 CONSTRAINT [PK\_saved\_graphs] PRIMARY KEY CLUSTERED   
 (  
 [id] ASC  
 )WITH (PAD\_INDEX = OFF, STATISTICS\_NORECOMPUTE = OFF, IGNORE\_DUP\_KEY = OFF, ALLOW\_ROW\_LOCKS = ON, ALLOW\_PAGE\_LOCKS = ON) ON [PRIMARY]  
 ) ON [PRIMARY] TEXTIMAGE\_ON [PRIMARY], [], , , false, false)

```
at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:362)

at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.runPrepUpdate(AbstractDBUtilities.java:258)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)
```

java.lang.Exception: java.lang.Exception: Error executing system.db.runPrepUpdate(CREATE TABLE [dbo].[saved\_graphs](  
 [id] [int] IDENTITY(1,1) NOT NULL,  
 [title] [nvarchar](50) NOT NULL,  
 [tagpens] [nvarchar](max) NOT NULL,  
 [axes] [nvarchar](max) NOT NULL,  
 [username] [nvarchar](50) NULL,  
 [lastmodified] [datetime] NOT NULL,  
 CONSTRAINT [PK\_saved\_graphs] PRIMARY KEY CLUSTERED   
 (  
 [id] ASC  
 )WITH (PAD\_INDEX = OFF, STATISTICS\_NORECOMPUTE = OFF, IGNORE\_DUP\_KEY = OFF, ALLOW\_ROW\_LOCKS = ON, ALLOW\_PAGE\_LOCKS = ON) ON [PRIMARY]  
 ) ON [PRIMARY] TEXTIMAGE\_ON [PRIMARY], [], , , false, false)

```
at org.python.core.Py.JavaError(Py.java:495)
at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:362)
at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.runPrepUpdate(AbstractDBUtilities.java:258)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction. __call__ (PyReflectedFunction.java:186)
at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction. __call__ (ScriptManager.java:431)
at org.python.core.PyObject. __call__ (PyObject.java:422)
at org.python.core.PyObject. __call__ (PyObject.java:426)
at org.python.pycode._pyx1914.createTables$1(<custom-function createTables>:59)
at org.python.pycode._pyx1914.call_function(<custom-function createTables>)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyBaseCode.call(PyBaseCode.java:149)
at org.python.core.PyFunction. __call__ (PyFunction.java:327)
at org.python.core.PyMethod. __call__ (PyMethod.java:124)
at org.python.pycode._pyx1913.f$0(<event:actionPerformed>:48)
at org.python.pycode._pyx1913.call_function(<event:actionPerformed>)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1275)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:636)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:180)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:271)
at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:57)
at com.sun.proxy.$Proxy18.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
```

Caused by: java.lang.Exception: Error executing system.db.runPrepUpdate(CREATE TABLE [dbo].[saved\_graphs](  
 [id] [int] IDENTITY(1,1) NOT NULL,  
 [title] [nvarchar](50) NOT NULL,  
 [tagpens] [nvarchar](max) NOT NULL,  
 [axes] [nvarchar](max) NOT NULL,  
 [username] [nvarchar](50) NULL,  
 [lastmodified] [datetime] NOT NULL,  
 CONSTRAINT [PK\_saved\_graphs] PRIMARY KEY CLUSTERED   
 (  
 [id] ASC  
 )WITH (PAD\_INDEX = OFF, STATISTICS\_NORECOMPUTE = OFF, IGNORE\_DUP\_KEY = OFF, ALLOW\_ROW\_LOCKS = ON, ALLOW\_PAGE\_LOCKS = ON) ON [PRIMARY]  
 ) ON [PRIMARY] TEXTIMAGE\_ON [PRIMARY], [], , , false, false)  
 ... 63 more  
Caused by: com.inductiveautomation.ignition.client.gateway\_interface.GatewayException: Error executing function 'RunPrepStmt': The current user does not have the required roles for this operation.  
 at com.inductiveautomation.ignition.client.gateway\_interface.GatewayInterface.newGatewayException(GatewayInterface.java:341)  
 at com.inductiveautomation.ignition.client.gateway\_interface.GatewayInterface.sendMessage(GatewayInterface.java:315)  
 at com.inductiveautomation.ignition.client.gateway\_interface.GatewayInterface.sendMessage(GatewayInterface.java:268)  
 at com.inductiveautomation.ignition.client.script.ClientDBUtilities.\_runPrepStmt(ClientDBUtilities.java:215)  
 at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.runPrepUpdate(AbstractDBUtilities.java:256)  
 ... 61 more  
Caused by: com.inductiveautomation.ignition.gateway.servlets.gateway.functions.GatewayFunctionException: The current user does not have the required roles for this operation.  
 at com.inductiveautomation.ignition.gateway.servlets.Gateway.doPost(Gateway.java:403)  
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)  
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)  
 at com.inductiveautomation.ignition.gateway.bootstrap.MapServlet.service(MapServlet.java:85)  
 at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:837)  
 at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:583)  
 at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)  
 at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)  
 at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)  
 at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1160)  
 at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)  
 at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)  
 at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1092)  
 at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)  
 at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)  
 at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)  
 at org.eclipse.jetty.server.Server.handle(Server.java:518)  
 at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:308)  
 at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:244)  
 at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)  
 at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)  
 at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)  
 at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:246)  
 at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:156)  
 at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)  
 at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)  
 at java.lang.Thread.run(null)

Ignition v7.9.8 (b2018060714)  
Java: Oracle Corporation 1.8.0\_171  
'''

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 24, 2018, 4:01pm UTC](https://forum.inductiveautomation.com/t/adhoc-trend-template-error/20349/5 "2018-10-24T16:01:59Z")

</div>

> [@erikburns](#):
>
> Caused by: com.inductiveautomation.ignition.client.gateway\_interface.GatewayException: Error executing function 'RunPrepStmt': The current user does not have the required roles for this operation.

As of Ignition 7.9.4 there's a new set of client scoped permissions that prevent even authenticated clients, by default, from changing anything on the gateway.

[https://docs.inductiveautomation.com/display/DOC79/Project+Properties#ProjectProperties-ClientPermissions](https://docs.inductiveautomation.com/display/DOC79/Project+Properties#ProjectProperties-ClientPermissions)

---

<div class="post-metadata">

**Author:** ![erikburns](https://avatars.discourse-cdn.com/v4/letter/e/e5b9ba/32.png) [@erikburns](https://forum.inductiveautomation.com/u/erikburns)\
**Post date:** [October 24, 2018, 4:13pm UTC](https://forum.inductiveautomation.com/t/adhoc-trend-template-error/20349/6 "2018-10-24T16:13:38Z")

</div>

What do I need to change to allow this script to run?

---

<div class="post-metadata">

**Author:** ![erikburns](https://avatars.discourse-cdn.com/v4/letter/e/e5b9ba/32.png) [@erikburns](https://forum.inductiveautomation.com/u/erikburns)\
**Post date:** [October 24, 2018, 8:44pm UTC](https://forum.inductiveautomation.com/t/adhoc-trend-template-error/20349/7 "2018-10-24T20:44:22Z")

</div>

MS Excel won’t open the file that I save using the Save Graph Data button.

---

<div class="post-metadata">

**Author:** ![drumdubb](https://avatars.discourse-cdn.com/v4/letter/d/9de053/32.png) [@drumdubb](https://forum.inductiveautomation.com/u/drumdubb)\
**Post date:** [February 26, 2020, 4:42pm UTC](https://forum.inductiveautomation.com/t/adhoc-trend-template-error/20349/8 "2020-02-26T16:42:40Z")

</div>

Did these settings get removed in 8.0?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [February 26, 2020, 4:54pm UTC](https://forum.inductiveautomation.com/t/adhoc-trend-template-error/20349/9 "2020-02-26T16:54:36Z")

</div>

No? What makes you ask?

---

<div class="post-metadata">

**Author:** ![drumdubb](https://avatars.discourse-cdn.com/v4/letter/d/9de053/32.png) [@drumdubb](https://forum.inductiveautomation.com/u/drumdubb)\
**Post date:** [February 28, 2020, 6:18pm UTC](https://forum.inductiveautomation.com/t/adhoc-trend-template-error/20349/10 "2020-02-28T18:18:09Z")

</div>

It appears the menu has just changed, I found the legacy DB setting. We are trying to get the ad-hoc trending template to work in 8, and had to enable that to stop an error but it seems like some other things are not working as well. Is there any plan to update the ad-hoc template for 8? I think its something that a lot of people have started using

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [February 28, 2020, 6:45pm UTC](https://forum.inductiveautomation.com/t/adhoc-trend-template-error/20349/11 "2020-02-28T18:45:44Z")

</div>

Are you using the latest version off the [Exchange](https://inductiveautomation.com/exchange/92/overview)? Our sales engineering department is in charge of updating it; I imagine they’d want to find out about any errors being thrown.

---

<div class="post-metadata">

**Author:** ![drumdubb](https://avatars.discourse-cdn.com/v4/letter/d/9de053/32.png) [@drumdubb](https://forum.inductiveautomation.com/u/drumdubb)\
**Post date:** [February 28, 2020, 6:49pm UTC](https://forum.inductiveautomation.com/t/adhoc-trend-template-error/20349/12 "2020-02-28T18:49:46Z")

</div>

The latest version on exchange is still 7.9

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [February 28, 2020, 8:54pm UTC](https://forum.inductiveautomation.com/t/adhoc-trend-template-error/20349/13 "2020-02-28T20:54:35Z")

</div>

That doesn’t mean it won’t work in 8.0. Nothing fundamental to Vision or the ad-hoc template should have broken in 8 - so details of specific errors would be useful.
