0

So, first of all hello to everyone, I hope you are having a good day :)

I will give you a little context. I coded a program for my job, in which I save to a database Errors ID and their solutions. It could be one or more solutions. Right now the database is a text file which contains a dictionary, with keys being the Error ID and the values, the solutions.

This database right now is local because of some approvals from my company, but the idea is to put the database on a server, so that users can consult and update it in real time.

The question is, should I keep it like a txt and have a script to allow the program to connect to the server (maybe sftp?) to be able to open, read and write the txt file OR should I export all the data to a db file using mysql/etc?

Thanks in advance, I hope you understand my question. Feel free to ask for more details if it isn't enough or for clarification.

  • Is this a knowledge-base of some kind? – Robert Harvey Mar 27 at 22:17
  • Yeah, it is. I would like to improve the program in some future to include a pdf/doc search and open them in the app. Like manuals or instructives to do certain things. – WhiteHeadbanger Mar 27 at 23:05
0

If you have several users that could potentially update the database in the same time, then a text file will not work.

If in the future you add more columns your code could change much.

If one problem can have multiple solutions, then handling 1-m relationship in text file is not practical.

If the number of problems get large overtime the text database approach will be slower.

With a text file, you will need to have a dedicated backup procedure for the file.

A text file may be logically corrupted if your program inserts a string in the wrong way (say with commas or special character). In this case you would not have correct delimiters.

You can forget all of the above issues if you use an RDBMS or NoSQL database. However, there will be significant coding required. Another valid solution is to use Google Spreadsheets or alike solution if you trust the users. You will still have the backup issue in this case.

In my opinion is to use a database to store and access data. Next option would be to use spreadsheet. Last option would be to use a text file. This especially true in case the data may be updated and/or you have more than 1 user. However, this comes with a cost.

  • Hello, how are you? Thanks for your answer. I trust my users because they have the same role as me, the only difference is that I'm a developer too and I'm trying to make things easier in here :) I will investigate RDBMS and NoSQL – WhiteHeadbanger Mar 27 at 16:43
  • OK, if you have questions maybe I can help. – NoChance Mar 27 at 19:56
0

the database is a text file which contains a dictionary, with keys being the Error ID and the values, the solutions

That's a good starting point and yes; I'd recommend putting it [safely] inside a database table.

Then you'll need to write an Application that allows Users to read and write from/to that table.

I can see lots of ways in which this could start to "grow" and become something bigger and more useful; recording when an error happened, to allow pattern analysis, recording contextual information like which program the error happened with, that sort of thing.

I'd discount the shared file idea entirely. All it takes is for a User to do:

  • Select All
  • Delete
  • Save

and your "database" is wiped out.

  • Hi, how are you? Thanks for your answer. I trust my users because they have the same role as me, the only difference is that I'm a developer too and I'm trying to make things easier in here :) Are you saying to put the txt file inside a database table or the data? – WhiteHeadbanger Mar 27 at 16:45
  • Put the data into a table. That way, people can edit just the rows that they're interested in. Put the whole file in there as a single unit and you'll need a Content Management System to micro-manage the changes that people make to it (including the hugely unhelpful "delete everything"). – Phill W. Mar 28 at 12:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.