| %line | %branch | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| net.sf.classifier4J.bayesian.DriverMangerJDBCConnectionManager |
|
|
| 1 | /* |
|
| 2 | * ==================================================================== |
|
| 3 | * |
|
| 4 | * The Apache Software License, Version 1.1 |
|
| 5 | * |
|
| 6 | * Copyright (c) 2003 Nick Lothian. All rights reserved. |
|
| 7 | * |
|
| 8 | * Redistribution and use in source and binary forms, with or without |
|
| 9 | * modification, are permitted provided that the following conditions |
|
| 10 | * are met: |
|
| 11 | * |
|
| 12 | * 1. Redistributions of source code must retain the above copyright |
|
| 13 | * notice, this list of conditions and the following disclaimer. |
|
| 14 | * |
|
| 15 | * 2. Redistributions in binary form must reproduce the above copyright |
|
| 16 | * notice, this list of conditions and the following disclaimer in |
|
| 17 | * the documentation and/or other materials provided with the |
|
| 18 | * distribution. |
|
| 19 | * |
|
| 20 | * 3. The end-user documentation included with the redistribution, if |
|
| 21 | * any, must include the following acknowlegement: |
|
| 22 | * "This product includes software developed by the |
|
| 23 | * developers of Classifier4J (http://classifier4j.sf.net/)." |
|
| 24 | * Alternately, this acknowlegement may appear in the software itself, |
|
| 25 | * if and wherever such third-party acknowlegements normally appear. |
|
| 26 | * |
|
| 27 | * 4. The name "Classifier4J" must not be used to endorse or promote |
|
| 28 | * products derived from this software without prior written |
|
| 29 | * permission. For written permission, please contact |
|
| 30 | * http://sourceforge.net/users/nicklothian/. |
|
| 31 | * |
|
| 32 | * 5. Products derived from this software may not be called |
|
| 33 | * "Classifier4J", nor may "Classifier4J" appear in their names |
|
| 34 | * without prior written permission. For written permission, please |
|
| 35 | * contact http://sourceforge.net/users/nicklothian/. |
|
| 36 | * |
|
| 37 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
|
| 38 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
|
| 39 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
|
| 40 | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR |
|
| 41 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
| 42 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
| 43 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
| 44 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
|
| 45 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
|
| 46 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
|
| 47 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
| 48 | * SUCH DAMAGE. |
|
| 49 | * ==================================================================== |
|
| 50 | */ |
|
| 51 | ||
| 52 | package net.sf.classifier4J.bayesian; |
|
| 53 | ||
| 54 | import java.sql.Connection; |
|
| 55 | import java.sql.DriverManager; |
|
| 56 | import java.sql.SQLException; |
|
| 57 | ||
| 58 | /** |
|
| 59 | * @author Nick Lothian |
|
| 60 | * |
|
| 61 | */ |
|
| 62 | public class DriverMangerJDBCConnectionManager implements IJDBCConnectionManager { |
|
| 63 | ||
| 64 | String dbURL; |
|
| 65 | String dbUser; |
|
| 66 | String dbPassword; |
|
| 67 | ||
| 68 | 0 | public DriverMangerJDBCConnectionManager(String url, String user, String password) { |
| 69 | 0 | this.dbURL = url; |
| 70 | 0 | this.dbUser = user; |
| 71 | 0 | this.dbPassword = password; |
| 72 | 0 | } |
| 73 | ||
| 74 | public String getDbPassword() { |
|
| 75 | 0 | return dbPassword; |
| 76 | } |
|
| 77 | ||
| 78 | public String getDbURL() { |
|
| 79 | 0 | return dbURL; |
| 80 | } |
|
| 81 | ||
| 82 | public String getDbUser() { |
|
| 83 | 0 | return dbUser; |
| 84 | } |
|
| 85 | ||
| 86 | public void setDbPassword(String string) { |
|
| 87 | 0 | dbPassword = string; |
| 88 | 0 | } |
| 89 | ||
| 90 | public void setDbURL(String string) { |
|
| 91 | 0 | dbURL = string; |
| 92 | 0 | } |
| 93 | ||
| 94 | public void setDbUser(String string) { |
|
| 95 | 0 | dbUser = string; |
| 96 | 0 | } |
| 97 | ||
| 98 | /** |
|
| 99 | * @see net.sf.classifier4J.bayesian.IJDBCConnectionManager#getConnection() |
|
| 100 | */ |
|
| 101 | public Connection getConnection() throws SQLException { |
|
| 102 | 0 | return DriverManager.getConnection(dbURL, dbUser, dbPassword); |
| 103 | } |
|
| 104 | ||
| 105 | /** |
|
| 106 | * @see net.sf.classifier4J.bayesian.IJDBCConnectionManager#returnConnection(Connection con) |
|
| 107 | */ |
|
| 108 | public void returnConnection(Connection con) throws SQLException { |
|
| 109 | 0 | con.close(); |
| 110 | 0 | } |
| 111 | ||
| 112 | } |
| This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |