Questions tagged [hdbc]

HDBC, Haskell Database Connectivity, is a Haskell library for connecting to and querying relational database management systems. The library provides a uniform interface to several common RDBMSs through the use of pluggable back ends.

59 questions
16
votes
3 answers

Cheapest way to determine if a MySQL connection is still alive

I have a pool of MySQL connections for a web-based data service. When it starts to service a request, it takes a connection from the pool to use. The problem is that if there has been a significant pause since that particular connection has been…
MtnViewMark
  • 5,120
  • 2
  • 20
  • 29
13
votes
2 answers

Does Haskell have a SQL query-composing library like ActiveRecord or Sequel?

With Ruby's ActiveRecord or Sequel, you can progressively build up SQL queries, adding where or join or order clauses to a query depending on conditions at run time. Here is a simple example, taken from ASCIIcasts: def index @articles =…
dan
  • 43,914
  • 47
  • 153
  • 254
10
votes
3 answers

Concurrent DB connection pool in Haskell

I am a Java programmer who learns Haskell. I work on a small web-app that uses Happstack and talks to a database via HDBC. I've written select and exec functions and I use them like this: module Main where import Control.Exception (throw) import…
oshyshko
  • 2,008
  • 2
  • 21
  • 31
7
votes
1 answer

Haskell arithmetic operations and DB persistence of arbitrary/fixed precision numbers

As a Haskell (GHC platform) beginner I bumped into a problem of dealing with data types and arithmetic operations related to business domain that involves currency/money operations and I'm looking for a solution. I'm developing application that is…
CMZ3Z3G6P3
  • 71
  • 1
6
votes
2 answers

Sqlite Foreign Keys

I try to enable foreign keys using HDBC-sqlite3 haskell library. This library uses a little helper c - function int sqlite3_open2(const char *filename, finalizeonce **ppo) which calls in turn sqlite3_open one. In the sqlite documentation I've…
bartoszw
  • 93
  • 6
5
votes
1 answer

Convert time for use in mysql

I am trying to load timestamps into mysql. All my times are UTCTime objects. The HDBC mysql implementation does not seem to like UTCTime objects although internally the documentation says that it treats all times as if they were UTC times. I believe…
Steve Severance
  • 6,611
  • 1
  • 33
  • 44
5
votes
1 answer

Generated SQL query not returning the same thing as the corresponding static query in sqlite3 HDBC

I am generating SQL queries in Haskell and submitting them to a SQLite(3) database using HDBC. Now, this function returns a query: import Database.HDBC.Sqlite3 import Database.HDBC data UmeQuery = UmeQuery String [SqlValue] deriving…
Fredrik Karlsson
  • 485
  • 8
  • 21
5
votes
1 answer

How do a put binary data into postgres through HDBC?

I have a Haskell application that, as one of many steps, needs to store and retrieve raw binary blob data in a database. I'm not completely above deciding to, instead, store that data in plain disk files, but that does start leading to an…
Savanni D'Gerinel
  • 2,379
  • 17
  • 27
5
votes
1 answer

HDBC ODBC MySQL - query only fails when compiled

My program runs with runghc but the same program consistently fails when compiled with error "Lost connection to MySQL server during query". The fail is not associated with a long running query (it is a CREATE VIEW on a small table). There is…
hdb3
  • 239
  • 1
  • 10
4
votes
1 answer

Specify a github url for a dependency in a cabal file

The HDBC-mysql package is currently broken for me. The fix is in this fork. How can I specify that I want cabal to build from this fork of HDBC-mysql?
Vlad the Impala
  • 15,572
  • 16
  • 81
  • 124
4
votes
1 answer

Using Haskell's HDBC, can I use a single SQLite connection across multiple threads?

If I want to query (read) from an SQLite database using Haskell's HDBC across multiple threads, can I use a single connection, or should each thread have its own connection? Thanks.
Chris
  • 941
  • 9
  • 18
4
votes
1 answer

Haskell HDBC memory leak

I tried putting together a resource pool and HDBC the other day but noticed that the memory keeps rising for each query. I then put together a simple test code using as few functions as possible and got this: data SQL = SQL (Pool Connection) check…
Plankt
  • 135
  • 4
3
votes
1 answer

HDBC-mysql "command out of sync"

I'm writing a web app using Snap 0.6 and the Snaplet-hdbc infrastructure. In the backend, I'm using HDBC-mysql to connect to MySQL. But when running the app, it gets a "Command out of sync, you can't run this command now" error from MySQL. I'am…
Eric Wong
  • 524
  • 9
  • 21
3
votes
2 answers

haskell `hdbc` ODBC connection gets disposed of immediately for remote MySQL instance

I am trying to connect to a MySQL database and run an SQL query using hdbc and hdbc-odbc main :: IO () main = do mysqlSettings <- readMySQLSettings putStr "Connecting to MySQL database..." mysqlConn <- connectODBC $ buildMySQLConnectionString…
Microtribute
  • 962
  • 10
  • 24
3
votes
1 answer

HDBC -odbc connecting with haskell

Now I want to connect db with haskell,I tried to install HDBC-ODBC,HSQL-ODBC,and HDBC-mysql using cabal,I was able to configure sqlite3,How I can add these package? I'm getting this error when I try to install it using cabal Resolving…
123Ex
  • 906
  • 2
  • 21
  • 34
1
2 3 4