Database connection routes

I have a small connection testing app with a database.
The app is called pestel, it has a simple interface that includes a text field. I want when pressing the add button to create a table called pesteltest that has an autoincrementing id and enter the text in a field called textest.
Could you help me with the different arrangements of php, routes…
Thanks

https://docs.nextcloud.com/server/latest/developer_manual/

And: Develop for Nextcloud: App development tutorials

Additionally, you can come to this room:

:seedling: Start Developing (Public)
https://cloud.nextcloud.com/call/3609520619

It sounds like you need done help that can be better given in a quicker one on one chat. If anyone in the room is available, they might help you get faster answers. But there is not always someone free…

If not possible, please read and post clear questions.

Could I create an app that connects to a database without using ocs?

Perhaps you’d be able to address your use case using the Tables rather than a custom Nextcloud app?

To formally answer your question:

OCS is not needed for database connection. It is a way to send standardized packages to the client in the HTT(P) protocol. There is no DB involved. You could (in your app) encapsulate the results in the OCS packages but this is up to you and your liking.

OCP is the Public namespace of the sever PHP code (legacy from owncloud I guess but this I am not sure about). It contains all the interfaces that an app is allowed to use directly. In contrast the OC (without P) namespace is the server code that is private. You should not use these classes directly as they might change name/function/parameters/… anytime. The server will inject the corresponding classes to your app based on the interfaces in the OCP namespace.

In order to connect with the DB, you need the DB connection class which is availanle using the OCP\IDBConnection interface (Interface of DBConnection).

If you struggle with programming, I am with jtr, the tables app might be your solution. If you just fell into a misunderstanding about ocs or want to learn to code, feel free to go ahead.

Cheers
Christian

1 Like