Mercurial > hg > ltpda
view m-toolbox/classes/+utils/@jmysql/jconnTodbconn.m @ 5:5a49956df427 database-connection-manager
LTPDAPreferences panel for new LTPDADatabaseConnectionManager
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Mon, 05 Dec 2011 16:20:06 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
% JCONNTODBCONN convert a java db connection to a MATLAB database % connection. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % DESCRIPTION: JCONNTODBCONN convert a java db connection to a MATLAB % database Toolbox connection. % % CALL: dbconn = utils.jmysql.jconnTodbconn(jconn); % % INPUTS: % jconn - a connection object like that returned from % utils.jmysql.connect. % % OUTPUTS: dbconn - a database toolbox connecton % % % VERSION: $Id: jconnTodbconn.m,v 1.1 2009/07/28 06:46:09 hewitson Exp $ % % HISTORY: 24-05-2007 M Hewitson % Creation % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function conn = jconnTodbconn(jconn) if nargin ~= 1 || ~isa(jconn, 'mpipeline.repository.RepositoryConnection') error('### The first argument should be a RepositoryConnection'); end host = char(jconn.getHostname); db = char(jconn.getDatabase); user = char(jconn.getUsername); pw = char(jconn.getPassword); dbdriver = getappdata(0, 'mysql_driver'); dburl = sprintf('jdbc:mysql://%s/%s',host,db); disp(sprintf('** Connecting to %s as %s...', host, user)) conn = database(db,user,pw,dbdriver,dburl); disp('** Connection status:') disp(ping(conn)) end