view m-toolbox/classes/+utils/@jmysql/dbconnTojconn.m @ 1:2014ba5b353a database-connection-manager

Remove old code
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Sat, 03 Dec 2011 18:13:55 +0100
parents f0afece42f48
children
line wrap: on
line source

% DBCONNTOJCONN convert a MATLAB database connection to a java db connection.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: DBCONNTOJCONN convert a MATLAB database toolbox connection
%              to a java db connection.
%
% CALL:        jconn = utils.jmysql.dbconnTojconn(dbconn);
%
% INPUTS:
%              dbconn - a database toolbox connecton
% 
% OUTPUTS:     
%              jconn - a connection object like that returned from
%                     utils.jmysql.connect.
%
%
% VERSION:     $Id: dbconnTojconn.m,v 1.1 2009/07/28 06:46:09 hewitson Exp $
%
% HISTORY:     24-05-2007 M Hewitson
%                 Creation
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



function jconn = dbconnTojconn(conn)
  
  if nargin ~= 1 || ~isa(conn, 'database')
    error('### The first argument should be a database connection');
  end

  r = regexp(conn.URL, '//(.+)/', 'tokens');
  host = r{1};
  
  db   = conn.Instance;
  user = conn.UserName;
  
  jconn = utils.jmysql.connect(host, db, user, '');
  
  
  
end