Giter VIP home page Giter VIP logo

Comments (4)

Philiphorst avatar Philiphorst commented on May 30, 2024

There is a work-around using the database toolbox.

Another method is using a method suggested in http://stackoverflow.com/questions/24438359/connecting-matlab-and-mysql-with-the-jdbc-driver

My new and working (for me) mysql_dbconnect.m looks like this

function [dbconnection, errmsg] = mysql_dbopen(serverhost, dbname, uname, pword)

javaaddpath('/home/philip/work/CompEngineMatlab/Database/mysql-connector-java-5.1.34-bin.jar')

% Open database
errmsg = []; % error message

% Now try to connect    

try
    d = com.mysql.jdbc.Driver;
    dburl = sprintf('jdbc:mysql://%s/%s', serverhost, dbname);
    props = java.util.Properties;
    props.put('user',uname); props.put('password',pword);
    dbconnection = d.connect(dburl,props);
catch le
    fprintf(1,'Error connecting to the database ''%s'' at ''%s'':\n%s\n',dbname,serverhost,le.message);
    fprintf(1,['Perhaps an incorrect username (''%s'') and password (''%s'') combination?\n'], uname, pword);
    dbconnection = [];
    % Not really a Matlab 'error' -- just print the suspected problem to screen
end

And it works like a charm. I think the problem lies with the

java.lang.Class.forName('com.mysql.jdbc.Driver', true, cl)

method. But that is just gut feeling

from hctsa.

Philiphorst avatar Philiphorst commented on May 30, 2024

The mysql_dbconnect.m seems to create a memory issue with java when running on multiple timeseries on my machine which results in a complete freeze of matlab.
java.lang.OutOfMemoryError: PermGen space

from hctsa.

benfulcher avatar benfulcher commented on May 30, 2024

Running out of memory usually happens when you're trying to retrieve a huge set of time series/operations. Matlab needs to keep the whole retrieval in memory, and it has a hard limit on this. The java heap size can be increased in the Matlab preferences:
f5245bac-a00c-46f7-b346-bcd4b6824548
(A related problem is exceeding the max_allowed_packet, and can be adjusted by changing the number of chunks for SQL_add_chunked: cf. lines 364--378 in SQL_add)

from hctsa.

benfulcher avatar benfulcher commented on May 30, 2024

This is now fixed -- mysql_dbopen uses the database toolbox if a license is available, otherwise reverts to the original implementation.

from hctsa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.