Are there instructions on how to implement LiteDB with Java or another language for accessing a database online? I have written an application in C# that uses LiteDB, but now I am trying to have it accessible by web and local intranet. So is Java the language for this?
Asked
Active
Viewed 1,373 times
1
-
It looks like LiteDB is a .NET embedded database so you are going to need the .NET framework. – Richard Chambers Apr 18 '17 at 15:37
-
Looking at the github repository at https://github.com/mbdavid/LiteDB it appears this library is written in C#. Any reason you can't create a web application with C#? https://msdn.microsoft.com/en-us/library/aa302124(v=vs.71).aspx or this youtube video https://www.youtube.com/watch?v=J7aStGi3hE8 or http://webproject.scottgu.com/CSharp/HelloWorld/HelloWorld.aspx – Richard Chambers Apr 18 '17 at 15:43
-
I could use C#, but I wanted it to be pretty modular on a given server, so it's better in Java? – ACopeLan Apr 18 '17 at 17:14
-
Not sure what "pretty modular" means. Are you saying you have a web server that is currently supporting Java for web services and trying to do this in C# would require changes to the server and the web services environment? Having an opinion as to whether it would be better to do in Java would require knowing quite a bit more about your environment. – Richard Chambers Apr 18 '17 at 17:55
-
Yes a test server... exactly. – ACopeLan Apr 18 '17 at 18:56
-
See http://stackoverflow.com/questions/6826391/how-can-i-use-a-net-assembly-in-java which has some discussion about using a .NET assembly in Java. And this would assume that your test server has the necessary .NET framework and components that you need. It looks to me like you either need to have a C# environment with C# application for LiteDB or you need to pick a different database engine that is more compatible with Java. If you have an existing server then does it already have a database engine and you don't need to use an embedded engine such as LiteDB? – Richard Chambers Apr 18 '17 at 19:30
-
I think that I'm going to need to use LiteDB. I think the library that was suggested by the comment below is probably the best translation method if I can't somehow compile LiteDB to have a java interface. – ACopeLan Apr 19 '17 at 13:46
1 Answers
3
C# is the language for this.
LiteDB is a serverless database designed to be embedded in .Net applications. Hence its only APIs are:
- Its C# API
- Its interactive shell
You could write a Java program that interacts with the shell, but it's a fairly fragile approach. You could write a Java program that uses some form of Java to C# glue layer to call C# methods (Google uncovered jni4net -- it seems to do that sort of thing; I can't promise anything about it).
However if your intention is to expose your database over the web, the path of least resistance is to either:
- Write a web service in C#
- or if you want to write web services in another language, recreate your database layer using a database with an API for that language (LiteDB says its API is similar to MongoDB, so perhaps MongoDB would be a good choice).

slim
- 40,215
- 13
- 94
- 127