[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Querying an Oracle DB from Octave?
From: |
CdeMills |
Subject: |
Re: Querying an Oracle DB from Octave? |
Date: |
Mon, 25 Jul 2011 01:09:30 -0700 (PDT) |
markbn wrote:
>
> Hi,
>
> I need to query data stored in Oracle databases. Is there any octave
> package that allows this?
>
> I read about octave-swig, but it does not have direct Oracle support. At
> most I guess I would need to use ODBC but I running octave from Linux and
> I don't have an administrative account to install ODBC anyway
>
>
Enclosed you'll find a script using perl ODBC interface. In your octave
script, you have to follow this pattern:
dbname="DBI:mysql:...:...";
dbuser="some_user";
dbpw="the_pass";
perl_sql = strcat("perl ./octave_sql_pipe ",dbname," ",dbuser," ",dbpw);
command = strcat(perl_sql," ","\"select Id from SomeTable where Date >='",
some_date, "'\"");
list_file = popen(command, "r");
Id = fscanf(pd_list_file,"%d");
pclose(pd_list_file);
It's a bit rudimentary, you should better enclose it in try/catch blocks,
but it does the job. The only supplemental dependencies are perl with ODBC.
Regards
Pascal
http://octave.1599824.n4.nabble.com/file/n3691868/octave_sql_pipe.pl
octave_sql_pipe.pl
--
View this message in context:
http://octave.1599824.n4.nabble.com/Querying-an-Oracle-DB-from-Octave-tp3689346p3691868.html
Sent from the Octave - General mailing list archive at Nabble.com.
Re: Querying an Oracle DB from Octave?,
CdeMills <=