help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Octave and databases


From: CdeMills
Subject: Re: Octave and databases
Date: Wed, 1 Sep 2010 02:57:57 -0700 (PDT)


Pohlen, Timo wrote:
> 
> Dear Ladies and Gentlemen,
>  
> I tried to connect Octave to a MySQL database - but all efforts were in
> vain. In spite of looking through manuals and tutorials on the internet,
> it was not possible to establish a connection that worked. In several
> forums I found comments that the database connectivity of Octave is not
> perfect. My question is: Is it possible at all to connect Octave to a
> MySQL database (or another database)? And if so, who can I establish a
> connection and retrieve data?
>  
> 

I looked in my archives and found a script I used a few years ago.

Octave code:
dbname="DBI:mysql:NAME_OF_THE_DB:HOST:PORT";
dbuser="USERNAME";
dbpw="PASSWORD";"

select_stmt = "select distinct(Run) from Measurements where Animal=%d";
perl_sql = strcat("perl ./octave_sql_pipe ",dbname," ",dbuser," ",dbpw ,
select_stmt);
list_Id = popen(perl_sql, "r");
Runs = fscanf(list_Id,"%d");
pclose(list_Id);

You construct the query, you execute externally by running perl, and you get
back the result. Perl code included, the result is faster if you compile it.

Regards

Pascal
http://octave.1599824.n4.nabble.com/file/n2402874/octave_sql_pipe.pl
octave_sql_pipe.pl 



-- 
View this message in context: 
http://octave.1599824.n4.nabble.com/Octave-and-databases-tp2402806p2402874.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]