Using Haskell with a database backend for "business applications" - database

I would like to know if there is any possibility that I can use Haskell with small database like sql server compact so that client wont have to install any server on his desktop.
Is there any api providing sql statements and so on ...
What is the best solution to achieve small database application using haskell.
thanks for help

SQLite is a great option for a small, lightweight database you can embed in your application. See HackageDB for a Haskell binding.

There are 57 database libraries and tools for Haskell on Hackage. The most popular is HDBC, an order of magnitude more popular than anything else, and has the HDBC-sqlite backend.

I would definitely recommend SQLite. If you are looking for a library to help keep the type safety of Haskell with a concise syntax, I would recommend checking out Persistent, which has a SQLite backend.

Related

how to make Database option in j2me for S40 development?

I've been searching on how to make a database in J2ME for S40 development, but it seems that Derby is too complicated and RMS doesn't have the capabilities of adding other columns and rows...
I just want to know if there's anything like SQLite for S40 development.
Or if there's a tutorial on how to use the Database component in the Visual Midlet for S40 development. because I don't know how to use it, and I really need to make a database for my application.
btw, I can't get rid of the database and use file communication because it's slow and complicated as well.
Thank you very much in advance :)
SQLite is not supported on Series40. In fact, I am not aware of any SQL databases that is available for Series40. RMS is your best option at this time. I can recommend using an object persistence framework such as Floggy for easier development with RMS.
SQLite never support with Java ME. Look at List of database framework for Java ME development. But I suggest don't use 3rd party database for S40. Because most of the s40 mobiles having small amount of heap memory (not more than 2 MB). So better way, Go with RMS.

Embedded (pure Java) database for Clojure

I'm in need for an embedded database for a Clojure application. Maybe it's the same criteria as for any other Java application but I rather get some other people's opinion anyway. I'm not picking SQLite because that's not pure Java so distribution of a standalone application gets much more complex. It seems the way to go is Apache Derby. Anything else I should consider?
Without a doubt, H2
Here are the settings,
(def demo-settings
{
:classname "org.h2.Driver"
:subprotocol "h2:file"
:subname (str (System/getProperty "user.dir") "/" "demo")
:user "sa"
:password ""
}
)
And then the usual Clojure SQL code:
(with-connection demo-settings
(create-table :DEMO_TABLE
[:M_LABEL "varchar(120)"]
[:M_DATE "varchar(120)"]
[:M_COMMENT "varchar(32)"]))
Have you looked at FleetDB? It's a Clojure database with a JSON protocol and clients in several languages. I suspect you could probably run it embedded without working too hard at it.
h2
oracle Berkley DB
I used an embedded database, H2 within clojure and used clojureQL to access it. Be warned though that since the database is in process you should not use this for large amounts of records (> than 10,000s in a single table) as you will get huge performance problems as the database and your code will both be sharing the same JVM
I think Derby makes an excellent 100% Java embedded database, and it's useful for a wide variety of applications, well-maintained by an active community, and very well documented.
If you don't mind NOSQL, neo4j is an embeddable graph db with transactions, licensed under the GPL. The most up to date bindings I've found are https://github.com/hgavin/borneo
There is also an interesting graph db project in clojure with pluggable backends: https://github.com/flatland/jiraph
The still quite young but promising looking OrientDB might be worth a look: http://www.orientechnologies.com/orient-db.htm
http://github.com/eduardoejp/clj-orient
Then there's http://jdbm.sourceforge.net/
I am using https://github.com/clojurewerkz/archimedes which allows you to specify a backend later.
Another option to consider is a key-value store Chronicle Map, because it's pure Java and provides a vanilla Java Map interface, so working with it should be very simple using Clojure.

Simplest way to develop an app that can use multiple types of databases?

I have a project for a class which requires that if a database is used, options exist for the user to pick a database to use which could be of a different type. So while I can use e.g. MySQL for development, in the final version of the project, the user must be able to choose a database (Oracle, MySQL, SQLite, etc.) upon installation. What's the easiest way to go about this, if there is an easy way?
The language used is up to me as long as it's supported by the department's Linux machines, so it could be Java, PHP, Perl, etc. I've been researching and found info on ODBC, JDBC, and SQLJ (such as this) but I'm quite new to databases so I'm having a hard time figuring out what would be best for my needs. It's also possible there may not be a simple enough way to do this; the professor admitted he's not a database guy either and he seemed to think it would be easy without having a clear idea of what it would take.
This is for a web app, but it ought to be fairly straight forward, using for example HTML and Javascript on the client side and Java with a MySQL database on the server side. No mention has been made of frameworks so I think they're too much. I have the option of using Tomcat or Apache if necessary but the overall idea is to keep things simple, and everything used should be able to be installed/changed/configured with just user level access. So something like having to recompile PHP to use ODBC would be out, I think.
Within these limitations, what would be the best way (if any) to be able to interact with an arbitrary database?
The issue I think you will have here is that SQL is not truely standard. What I mean is that vendors (Oracle, MySQL etc) have included types and features that are not SQL standard in order to "tie you in" to their DB, such as Oracle's VARCHAR2 and so on.
When I was at university, my final year project was to create an application that allowed users to create relational databases using JDBC with a Java front-end.
The use of JDBC was very simple but the issue was finding enough SQL features/types that all the vendors have in common. So they could switch between them without any issues. A way round this is to implement modules to deal with vendor specific issues and write ways to translate between them. So for example you may develop a database for MySQL with lots of MySQL specific code in that, but then you may want to use Oracle and then there are issues, which you would need to resolve.
I would spend some time looking at what core SQL standard all the vendors implement and then code for these features. But I think the technology you use wouldn't be the issue but rather the SQL you create.
Hope this helps, apologies if its not helpful!
Well, you can go two ways (in Java):
You can develop your own classes to work with different databases and load their drivers in JDBC. This way you will create a data access layer for yourself, which takes some time.
You can use Hibernate (or other ORMs). This way Hibernate will take care of things for you and you only have to know how to use Hibernate. Learning Hibernate may take some time, but when you get used to it, it can be very useful for your future projects.
If you want to stick Java there Hibernate (which wouldn't require a framework). Hibernate is fairly easy to use. You write HQL which gets translated to the SQL needed for the database you're using.
Maybe use an object relational mapper (ORM) or database abstraction layer (DAL). They are designed to provide a standard API to multiple database backends, making it possible to switch between different backends with minimal or no changes to your code. In Python, for example, a popular ORM is SQLAlchemy, and an excellent DAL is the web2py DAL (it's part of the web2py framework but can be used as a standalone DAL outside the framework as well). There are many other options in other languages as well.
use a framework with database abstraction layer and orm . try symfony or rails
There are a lot of Object relational database frameworks, unless you prefer jdbc. For simple/small applications this should work fine.

Is learning the Caché database hard coming from relational databases and object oriented programming language like Delphi?

I am currently running the local version of Caché on my system in order to determine if I can (and will) take on a new possible project.
The current project uses Delphi 7 as a front end calling a Caché dll where the business logic is stored in the database.
I have a background of Sqlserver and Firebird (and before Access and Paradox) as databases.
I use Delphi 7 for 95% of my Windows development, so I know about object programming.
I would like to recieve opinions from persons having used Caché and either SqlServer, Firebird or Oracle and having developed in Delphi (or C++ or C# - an object oriented language).
I have read the pro's and con's from other questions, but I am not asking for this, I need input from Caché developers.
Thanks in advance.
I am curious about this object database. I don't see any reference to Delphi users with this database on their web site. They do mention they have a COM interface, which might be easier than a Raw C style API (if they also have that) because at least string buffer allocation/management and your wrapper code will hopefully be simpler.
However, you will have no way of connecting to data aware controls, so I would plan on doing a lot of "roll your own" work. My intuitive opinion is that you might be the only guy on the planet using Delphi with this database. Delphi is a small fish in the development tools world though, so that might just more be a fact about Delphi more than a fact about Cache, which is a horribly NON-Googlable technology name, by the way.
You can find information about Caché by googling for Intersystems--that's really the best way. You can also search under the old name of the language, MUMPS.
I knew nothing about Caché when I started working on it fresh out of college, and I don't think it was that hard to learn. Like most scripting languages, it's best to learn by trying things out in the terminal and learning your way around.
Also, Caché has a built-in SQL mapping system so that you can have it behave like a relational database externally but still leverage some of the powerful non-relational concepts under the hood.
The company that I worked just a little time ago uses Caché and they have a bunch of projects using Caché and delphi. In fact, they uses the VISM.OCX just to connect and pass parameters to database (PLIST variable and such) but in any time they run any M command directly from application to DB, just call the routines.
Is not that hard to learn about it, but in nowdays we are leaving it! Beside Caché is incredibly fast, the lack of tools and support don't makes him a good option in nowdays...even there's a rumour that intersystems is "leaving the boat" of caché to work in a new system.
I have been working on the 2008 Caché version for a few months now. It's possible to learn\use, but extremely unpleasant. The IDE is simplistic and unhelpful with errors (it doesn't even pick up case sensitive syntax problems until it crashes at runtime). The documentation is terrible and there's nothing online, compared to to the amount of information on SQL Server or MySql. And you're learning something that probably won't be of much help in your future career. Personally, I would avoid any project that uses Caché if you have any alternative.
Friend, there are two ways to access Caché via Delphi, and is a personal project of Brazil - friends - who are developing a framework for free Caché Object Oriented.
I tell you, you're not only using Caché with Delphi, but I do not recommend. The best would be to use CSP pages, or use some better language like C # or C + +. I worked a lot with CSP and recommend to you. After all, remember, the Internet is all.
I can send you some examples - I think I have at home - just send me a message.
Sucess

Visually designing a database structure

I am quite happy to code out tables by hand when making a database but it's not the easiest way to convey information about a database to someone else, especially someone that's not so comfortable coding the tables via a script and would instead use something such at phpMyAdmin.
Is there thus a free program (for me to use it it'll have to work on a Mac but feel free to suggest PC apps for others with the same Q) or script (preferably in PHP or Python) that allows you to design database structure and will then output either a basic diagram or the code as chosen by the user?
Well on the PC you can use MS Visio to produce a DB Entity diagram.
It will even reverse engineer one from an existing Database.
A pain to set-up the first time you use it, but quite handy thereafter.
Open System Architect has some potential. Its very similar to Visio.
I'm a big fan of ARGO UML from Tigris.org. Draws nice pictures using standard UML notation. It does some code generation, but mostly Java classes, which isn't SQL DDL, so that may not be close enough to what you want to do.
You can look at the Data Modeling Tools list and see if anything there is better than Argo UML. Many of the items on this list are free or cheap.
Also, if you're using Eclipse or NetBeans, there are many design plug-ins, some of which may have the features you're looking for.
I use the aptly named Database Design Tool. It's extremely simple and unfortunatly it's developed any more, however. It's the best tool I've come across that is free and at the end of designing your tables, it generates the T-SQL for you. It's also language independent.
You could try out MySQL Workbench which originates in the open source dbdesigner. There's a free community edition available. You can design the database via er-diagrams or reverse engineer an existing database.
MySQL Workbench is the best DB design tool that I've tried
I'm currently checking out SQL Power Architect (both w/ PostgreSQL and Mysql - but it also supports other vendors) and it definitely seems promising. Does both forward and backward SQL engineering. The Community Edition is open source and cross platform (Java). You can check it out yourself: http://code.google.com/p/power-architect/
When strictly dealing w/ MySQL so far I've otherwise used MySQL Workbench, http://wb.mysql.com/ which performed reliably.
I always have enjoyed Eclipse. There are a few plugins for it that look like they will do what you want.
SchemaBank (a web-based SaaS vendor) can turn your ER design into SQL statements for MySQL and PG. Can't do graphics export yet though. The nice thing is you don't need to install anything ('cos its browser-based) and it costs virtually nothing. You should be able to share your design to other people too.
SQLDeveloper from Oracle can work with Oracle and MySQL database.
http://www.oracle.com/us/corporate/press/020861

Resources