chrix75

chrix75

Hi,

I continue my Elixir exploration and now I’m trying to fetch data from our databases that are Oracle DB.
I’ve found I must use the Erlang :odbc module and pass through ODBC connection.

I’ve installed the Oracle ODBC driver and set a Data Source but when I try to connect, that fails.

Below my actions and their results:

iex(18)> :odbc.start()
:ok
iex(19)> {ok, ref} = :odbc.connect('DSN=SIRENE_REC;UID=account;PWD=the_password', [])

13:25:21.953 [error] [79, 68, 66, 67, 58, 32, 114, 101, 99, 101, 105, 118, 101, 100, 32, 117, 110, 101, 120, 112, 101, 99, 116, 101, 100, 32, 105, 110, 102, 111, 58, 32, [123, ['tcp_closed', 44, '#Port<0.1505>'], 125], '\n'] {:error, :connection_closed}

13:25:21.954 [error] GenServer #PID<0.125.0> terminating
** (stop) {:port_exit, :collecting_of_driver_information_faild} Last message: {#Port<0.1503>, {:exit_status, 23}} State: {:state, #Port<0.1503>, {#PID<0.81.0>, #Reference<0.1271860022.1836056577.135740>}, #PID<0.81.0>, :undefined, :on, :undefined, :undefined, :on, :connecting, :undefined, 0, [#Port<0.1501>, #Port<0.1502>], #Port<0.1504>, #Port<0.1505>}

For my noob level, I’m lost :blush:

Showing Posts 1 to 9

NobbZ

NobbZ

Have you done the prechecks from the Erlang ODBC Guide?

In the getting started section there are some things listed to consider and make sure first:

  • The first thing you need to do, is to make sure you have an ODBC driver installed for the database that you want to access. Both the client machine where you plan to run your erlang node and the server machine running the database needs the the ODBC driver. (In some cases the client and the server may be the same machine).
    *Secondly you might need to set environment variables and paths to appropriate values. This may differ a lot between different os’s, databases and ODBC drivers. This is a configuration problem related to the third party product and hence we can not give you a standard solution in this guide.
  • The Erlang ODBC application consists of both Erlang and C code. The C code is delivered as a precompiled executable for windows, solaris and linux (SLES10) in the commercial build. In the open source distribution it is built the same way as all other application using configure and make. You may want to provide the the path to your ODBC libraries using --with-odbc=PATH.

The payload of the error, which got mangled in some way (perhaps something in the chain has problem with IO-Lists?) says roughly that there was an unexpected {'tcp_closed', '#Port<0.1505>'}. Further I have to assume that this is printed by some erlang subroutine and therefore 'tcp_closed is an atom. Anyway. It boils down to a closed TCP connection, which may have many reasons, but I’ve not used any ODBC so far.

Therefore I want to ask you if you can access to that database from another program that uses ODBC, does this program see the same set of environment variables as your erlang program? Has your version of erlang been compiled with a proper value for --with-odbc?

chrix75

chrix75 OP

My sole test is the “Test connection” from the ODBC configuration window and the connection works in that case. I don’t have other program using ODBC (currently, all programs are in Java and we use JDBC).
About Erlang compliation options, I don’t know :confused: I use the Erlang version provided by the Elixir Windows installer.
I’ve no idea how it is compiled.

chrix75

chrix75 OP

I tried my ODBC connection after installing MS ODBC Test program.
The connection works fine with this tools (connection, queries, …).

chrix75

chrix75 OP

I’ve just read how compile Erlang OTP on Windows :fearful:
When I see all needed steps, I’m discouraged.

OvermindDL1

OvermindDL1

Instead of using ODBC (which kind of sucks), have you thought about using a direct Oracle driver like jamdb_oracle or so?

I personally mount my work Oracle database as a FDW inside my PostgreSQL database. ^.^

OvermindDL1

OvermindDL1

Interesting, how does it compare to this?
https://github.com/erlangbureau/jamdb_oracle

CharlesO

CharlesO

Adapter to Oracle Database. Using DBConnection and ODBC

it’s still basically just Erlang ODBC under the covers.

Do you know of any attempt to do a JDBC - Erlang Bridge?

I have a reporting tool built on Elixir using ODBC, but a prospective new client is on T24 (JBASE), i’m looking for possible ways to connect, so far Erlang ODBC does not work for this as i do not have a suitable driver.

SQL Squirrel is able to connect via jbase-jdbc, hence the search for a jdbc-erlang connector.

T24 JBASE has a jbase_agent that is basically a socket acceptor, so it makes me hopeful that a pure Elixir/ erlang driver might even be the way to go (if i can just understand how jdbc interacts with JBASE)

jAGENT

jBASE jAgent is a server-side jBASE component which must be listening on a user-defined TCP port on the remote jBASE instance. It accepts socket connections to process incoming requests from Client Applications implementing the jRemote Client API. Please refer to the jBASE jAgent user guide for more information on how to configure and start jAgent.

Sample Project

There is a sample project in github using c# and jAgent. Click here to view.

OvermindDL1

OvermindDL1

All the lower-case j prefixes make me think java. You could always write a Java Erlang node (the java api comes with the erlang distribution) for Elixir to talk to. ^.^

— All posts loaded —

Where Next? Top

Trending in Questions Top

Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
Onor.io
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
jaybe78
Hello, I’m developing a online persistent chat system (what’s app) like using elixir/dynamodb/aws for a mobile app(flutter). The diffic...
New
Trolleger
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
matt-savvy
Anyone here using Honeybadger? My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of Bandit.HTTPError...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New

Other Trending Topics Top

sorenone
This release unifies configuration for queues, repos, and services, swaps opaque timing integers for readable durations, and backports pe...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews