I got it working before your update. Yay! Thank you! There were a couple of issues, mostly documentation, leaving aside getting ODBC setup outside of julia.
The docs (the help at https://github.com/JuliaDB/ODBC.jl) say to use DSN to get things going. As far as I can tell, it doesn't exist. I used connect. The docs mention a connection string, but provide no pointers to its content. It would be nice to have one; the odbc packages I installed were almost documentation free. The docs imply the results of a query need to be turned into a DataFrame, but it seems to come out as one. The source code suggested one could get a dataframe with the output argument. I'm not really sure what that's supposed to be or do, but when I tried julia> raw = ODBC.query("SELECT isim, id, x, t, y, regular, censor, wait from obs2619 where isim=1", conn, output=df ) ERROR: TypeError: typeassert: expected Union{AbstractString,DataType}, got Function I had not set df to anything before the call, AFAIK. Ross ________________________________ From: [email protected] [[email protected]] on behalf of Jacob Quinn [[email protected]] Sent: Tuesday, May 03, 2016 7:57 PM To: [email protected] Subject: Re: [julia-users] Can't add PostgreSQL Hey Ross, Just confirmed that connecting to Postgres does indeed work; haven't seen any issues yet. I'm using the PostgreSQL ODBC Driver from their website with unixODBC on a mac. I'm using a connection string I built by following the guidelines here: http://www.connectionstrings.com/postgresql-odbc-driver-psqlodbc/ Here's a little sample code (I have more testing all the various data types in Postgres, but I won't post the full snippet here): using ODBC dsn = ODBC.DSN("Driver={PostgreSQL};Server=[server];Port=5432;Database=testdb;Uid=username;Pwd=password") # Check some basic queries dbs = ODBC.query(dsn, "SELECT datname FROM pg_database WHERE datistemplate = false;") data = ODBC.query(dsn, "SELECT table_schema,table_name FROM information_schema.tables ORDER BY table_schema,table_name;") The latest ODBC release was just merged in METADATA.jl, so if you do Pkg.add("ODBC") you should get the latest release/code. If you already had it installed, just run Pkg.update() to get the latest release. Good luck! -Jacob On Tue, May 3, 2016 at 7:11 PM, Boylan, Ross <[email protected]<mailto:[email protected]>> wrote: Attempting to post comments inline, even though my mailer is allergic. Look for >> From: [email protected]<mailto:[email protected]> [[email protected]<mailto:[email protected]>] on behalf of Jacob Quinn [[email protected]<mailto:[email protected]>] Sent: Tuesday, May 03, 2016 5:47 PM I'm not sure I understand: I don't see DBI.jl nor PostgreSQL.jl at pkg.julialang.org<http://pkg.julialang.org>, which tells me they aren't officially registered as packages. The difficulties you're seeing then aren't that surprising because they haven't felt comfortable enough to officially register. >> You're right. I got to them through https://github.com/JuliaDB ODBC actually works fine on Linux/OSX through the unixODBC library. It can be installed through a variety of means, but works quite well from what I've seen. Postgres is actually next on my list to test with ODBC (so far the testing has focused on Teradata, SQL Server, and MySQL), so if I find time in the next few days, I'll try to put together an example and share it here. >> The status page indicates errors with julia 0.4 and Linux. Does it matter? >> Clicking on the build logs it appears the most recent build for 0.4, 124.4 >> (https://travis-ci.org/JuliaDB/ODBC.jl) succeeded, so I'm not sure why the >> problem is showing (also the previous error looks like a problem with the >> configuration of the build machine rather than a problem with the package). >> No joy with the alternate Postgresl package; >> https://github.com/NCarson/Postgres.jl/issues/3 has the details. >> So I guess I'll give ODBC a whirl. Thanks for your help.
