Mercurial > hg > ltpda
comparison m-toolbox/classes/+utils/@jmysql/dbconnTojconn.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 % DBCONNTOJCONN convert a MATLAB database connection to a java db connection. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: DBCONNTOJCONN convert a MATLAB database toolbox connection | |
5 % to a java db connection. | |
6 % | |
7 % CALL: jconn = utils.jmysql.dbconnTojconn(dbconn); | |
8 % | |
9 % INPUTS: | |
10 % dbconn - a database toolbox connecton | |
11 % | |
12 % OUTPUTS: | |
13 % jconn - a connection object like that returned from | |
14 % utils.jmysql.connect. | |
15 % | |
16 % | |
17 % VERSION: $Id: dbconnTojconn.m,v 1.1 2009/07/28 06:46:09 hewitson Exp $ | |
18 % | |
19 % HISTORY: 24-05-2007 M Hewitson | |
20 % Creation | |
21 % | |
22 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
23 | |
24 | |
25 | |
26 function jconn = dbconnTojconn(conn) | |
27 | |
28 if nargin ~= 1 || ~isa(conn, 'database') | |
29 error('### The first argument should be a database connection'); | |
30 end | |
31 | |
32 r = regexp(conn.URL, '//(.+)/', 'tokens'); | |
33 host = r{1}; | |
34 | |
35 db = conn.Instance; | |
36 user = conn.UserName; | |
37 | |
38 jconn = utils.jmysql.connect(host, db, user, ''); | |
39 | |
40 | |
41 | |
42 end | |
43 |