Database Connection Clarification

I am a little confused about how the database connects to Omeka Classic. I see online they mention that it needs to be of a certain class to be able to user? Not sure if I am 100% correct about that.

Would it be possible if I already have a database, connect it to Omeka Classic, and display the data from that database in Omeka without having to make it a certain class?

Any help will be appreciated

I’m not sure I totally understand your question.

Omeka uses a MySQL database to store its data in. Are you talking about taking an existing, non-Omeka database with data already in it and using that? If so, that’s not really how Omeka works.

I was talking about the second part, so if I already have an existing non-omeka MySQL database.
So does that mean that I would have had to connect an Omeka MySQL database as I was setting it up in the first place?

Yeah, so when setting up Omeka you provide connection details to MySQL, so you’d point it at a new, empty database, typically.

I am still a little confused because if I am able to provide connection details to a MySQL database, wouldn’t it be possible for me to point to an already existing MySQL database. Or does it need to be an empty database?

Omeka Classic can run alongside existing tables in a database, if that’s what you want to do: you can provide a “prefix” that Omeka will use at the start of all its table names (by default it’s “omeka_”) to make sure there’s no conflicting names with your existing tables.

It won’t actually use any of the data from those other, pre-existing tables, though.

So Omeka would not be able to display any of the data from the existing database?

That’s right. There’s no way to just point Omeka at an existing unrelated database and have it read the data.

You can try various methods of moving data over, like making a CSV of your existing data and importing that with the CSV Import plugin, to use existing data, but you can’t just use a database like that directly.

If the existing database has the required columns that Omeka needs, would it be possible to connect it to Omeka?
Also, would it be possible for the database and the code to be on two different servers?

You can have the database server on a different machine than Omeka is running on, yes. That’s why there’s a “host” configuration option when you provide the database credentials.

As for the existing database question: my basic answer is no. It’s technically possible, if you know what to do, to handcraft a database Omeka can use, but it’s not something that’s simple or easy: Omeka uses many tables, and these reference each other in many places. It wouldn’t be a situation where you could take unrelated data and just change a couple column names and get it to work.

Is it possible to move the current database connected with Omeka to a new server?

Yes. You can use MySQL’s dump and restore capabilities to move the database around to different servers with no issue.

Awesome thanks!

Is it the same thing for Omeka S or are these database rules only Omeka Classic?

The only real distinction for S is that it needs its own database, it doesn’t support the “prefix” system that Classic does. MySQL doesn’t have any issues having multiple databases per server, so this usually isn’t a problem.

The rest, about the structure required, and the ability to copy the database and to connect to a database on a different server, that’s all the same.

Thank you so much for answering all my questions! I really appreciate it :slightly_smiling_face: