# Creating OPC Connection on Gateway through Java SDKs

**URL:** <https://forum.inductiveautomation.com/t/creating-opc-connection-on-gateway-through-java-sdks/93133>\
**Category:** Module Development\
**Tags:** ignition80\
**Created:** [July 12, 2024, 9:18am UTC](https://forum.inductiveautomation.com/t/creating-opc-connection-on-gateway-through-java-sdks/93133 "2024-07-12T09:18:48Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Srivatsa\_N](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@Srivatsa\_N](https://forum.inductiveautomation.com/u/Srivatsa_N)\
**Post date:** [July 12, 2024, 9:18am UTC](https://forum.inductiveautomation.com/t/creating-opc-connection-on-gateway-through-java-sdks/93133/1 "2024-07-12T09:18:48Z")

</div>

HI, I am trying to create a OPC connection on Gateway through Java SDK and not use Gateway web interface. Below is where I wanted to see the connection and have added the necessary code.

 ![Screenshot 2024-07-12 at 2.41.48 PM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/5/75dbc590c4e9fac09cc7b61d5cd79f2380927796.png)

The method needs a parameter called "properties". I have created it like below, but I could not find anywhere what values can be put ?

```python
OpcConnectionManager clientManager = gatewayContext.getOpcManager();
PropertySet properties = new BasicPropertySet();
OpcSubscription subscription = clientManager.createSubscription("OPC-Connection-1", "Subscription-1",properties);

```

It might need the endpoints, security mode etc. What are the "keys" for this ?

An example would be

````python
Property<?> someKey;
properties.set(someKey, "someValue");```
````

---

<div class="post-metadata">

**Author:** ![PRASHANTH\_KAKKIRALA](https://avatars.discourse-cdn.com/v4/letter/p/76d3ee/32.png) [@PRASHANTH\_KAKKIRALA](https://forum.inductiveautomation.com/u/PRASHANTH_KAKKIRALA)\
**Post date:** [July 12, 2024, 11:07am UTC](https://forum.inductiveautomation.com/t/creating-opc-connection-on-gateway-through-java-sdks/93133/2 "2024-07-12T11:07:39Z")

</div>

Also, is there an API available for creating a new OPC connection?

we would look to add a new OPC UA Server connection from our screen instead of going to gateway config screen. Is that possible ?

---

<div class="post-metadata">

**Author:** ![PRASHANTH\_KAKKIRALA](https://avatars.discourse-cdn.com/v4/letter/p/76d3ee/32.png) [@PRASHANTH\_KAKKIRALA](https://forum.inductiveautomation.com/u/PRASHANTH_KAKKIRALA)\
**Post date:** [July 12, 2024, 12:20pm UTC](https://forum.inductiveautomation.com/t/creating-opc-connection-on-gateway-through-java-sdks/93133/3 "2024-07-12T12:20:03Z")

</div>

system.opcua.addConnection(name, description, discoveryUrl, endpointUrl, securityPolicy, securityMode, settings)  
this seems to be working.

Is it possible to access ignition gateway config screens by some means from designer web application ?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 12, 2024, 12:30pm UTC](https://forum.inductiveautomation.com/t/creating-opc-connection-on-gateway-through-java-sdks/93133/4 "2024-07-12T12:30:38Z")

</div>

> [@PRASHANTH\_KAKKIRALA](#):
>
> from designer

No, they have different security policies.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [July 12, 2024, 12:32pm UTC](https://forum.inductiveautomation.com/t/creating-opc-connection-on-gateway-through-java-sdks/93133/5 "2024-07-12T12:32:31Z")

</div>

> [@PRASHANTH\_KAKKIRALA](#):
>
> we would look to add a new OPC UA Server connection from our screen instead of going to gateway config screen. Is that possible ?

You can build a Vision or Perspective screen that calls `system.opcua.addConnection`.

---

<div class="post-metadata">

**Author:** ![Srivatsa\_N](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@Srivatsa\_N](https://forum.inductiveautomation.com/u/Srivatsa_N)\
**Post date:** [July 12, 2024, 1:55pm UTC](https://forum.inductiveautomation.com/t/creating-opc-connection-on-gateway-through-java-sdks/93133/6 "2024-07-12T13:55:34Z")

</div>

So, there is no way to create OPC connection on Gateway through SDKs?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 12, 2024, 2:00pm UTC](https://forum.inductiveautomation.com/t/creating-opc-connection-on-gateway-through-java-sdks/93133/7 "2024-07-12T14:00:03Z")

</div>

Probably, but not supported and not exposed in the official API jars. You are on your own (as is typically true for anything related to the SDK).

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [July 12, 2024, 2:18pm UTC](https://forum.inductiveautomation.com/t/creating-opc-connection-on-gateway-through-java-sdks/93133/8 "2024-07-12T14:18:25Z")

</div>

Correct, it's not supported by the SDK.
