Re: [JSPDBAdmin-Developers] CVS: jspdbadmin/src/java/org/jspdbadmin/util/jdbc OracleDataSource.java,
Status: Planning
Brought to you by:
aalmenar
From: Adrian A. <aal...@ca...> - 2002-08-08 23:49:02
|
how about making a CVS list, just to see the commits ? ----- Original Message ----- From: "Don" <do...@cr...> To: <jsp...@li...> Sent: Thursday, August 08, 2002 12:49 Subject: Re: [JSPDBAdmin-Developers] CVS: jspdbadmin/src/java/org/jspdbadmin/util/jdbc OracleDataSource.java,NONE,1.1 MySQLDataSource.java,NONE,1.1 > I don't think you need to include the java source code in your mail list. > It makes the message too heavy. We can just checkout from the cvs. > > Best, > Don. > > ----- Original Message ----- > From: "Adrian Almenar" <aal...@us...> > To: <jsp...@li...> > Sent: Thursday, August 08, 2002 12:01 AM > Subject: [JSPDBAdmin-Developers] CVS: > jspdbadmin/src/java/org/jspdbadmin/util/jdbc OracleDataSource.java,NONE,1.1 > MySQLDataSource.java,NONE,1.1 > > > > Update of /cvsroot/jspdbadmin/jspdbadmin/src/java/org/jspdbadmin/util/jdbc > > In directory > usw-pr-cvs1:/tmp/cvs-serv6099/src/java/org/jspdbadmin/util/jdbc > > > > Added Files: > > OracleDataSource.java MySQLDataSource.java > > Log Message: > > Maybe Some Helpful Classes > > > > --- NEW FILE: OracleDataSource.java --- > > > /*************************************************************************** > *** > > * JSPDBAdmin: Software to maintain and administrate Databases > * > > * Copyright (C) 2001 Adrian Almenar > * > > * > * > > * This program is free software; you can redistribute it and/or modify > * > > * it under the terms of the GNU General Public License as published by > * > > * the Free Software Foundation; either version 2 of the License, or > * > > * (at your option) any later version. > * > > * > * > > * This program is distributed in the hope that it will be useful, > * > > * but WITHOUT ANY WARRANTY; without even the implied warranty of > * > > * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > * > > * GNU General Public License for more details. > * > > * > * > > * You should have received a copy of the GNU General Public License > * > > * along with this program; if not, write to the Free Software > * > > * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 > USA * > > > **************************************************************************** > **/ > > > > /* > > * $Id: OracleDataSource.java,v 1.1 2002/08/08 05:01:50 aalmenar Exp $ > > * $Date: 2002/08/08 05:01:50 $ > > */ > > > > package org.jspdbadmin.util.jdbc; > > > > import java.io.PrintWriter; > > import java.sql.*; > > import javax.sql.*; > > > > /***************************************************************** > > * This class only implements <code>DataSource</code> for Oracle > > * <b>TODO: (Need to be more specific here)</b> > > * @author <a href="mailto:aal...@ca...">Adrian Almenar</a> > > * @version $Revision: 1.1 $ > > *****************************************************************/ > > public class OracleDataSource implements DataSource { > > > > public static { > > new oracle.jdbc.driver.OracleDriver(); > > } > > > > protected boolean usingThinDriver; > > protected String description = "Oracle Datasource"; > > protected String serverName; > > protected int portNumber; > > protected String databaseName; > > > > > > public OracleDataSource(String host, int port, String sid) { > > setServerName(host); > > setPortNumber(port); > > setDatabaseName(sid); > > usingThinDriver = true; > > } > > > > public OracleDataSource(String sid) { > > setDatabaseName(sid); > > usingThinDriver = false; > > } > > > > public boolean isUsingThinDriver() { > > return usingThinDriver; > > } > > > > public void setUsingThinDriver(boolean thin) { > > usingThinDriver = thin; > > } > > > > public String getDescription() { > > return description; > > } > > > > public void setDescription(String desc) { > > description = desc; > > } > > > > public String getServerName() { > > return serverName; > > } > > > > public void setServerName(String name) { > > serverName = name; > > } > > > > public int getPortNumber() { > > return portNumber; > > } > > > > public void setPortNumber(int port) { > > portNumber = port; > > } > > > > public String getDatabaseName() { > > return databaseName; > > } > > > > public void setDatabaseName(String name) { > > databaseName = name; > > } > > > > public Connection getConnection() throws SQLException{ > > return getConnection(null, null); > > } > > > > public Connection getConnection(String userid, String password) throws > SQLException { > > String url = "jdbc:oracle:" + getSubname(); > > return DriverManager.getConnection(url, userid, password); > > } > > > > protected String getSubname() { > > return (isUsingThinDriver() > > ? "thin:@" + getServerName() + ":" + getPortNumber() + ":" + > getDatabaseName() > > : "oci8:@" + getDatabaseName()); > > } > > > > public int getLoginTimeout() throws SQLException { > > return DriverManager.getLoginTimeout(); > > } > > > > public PrintWriter getLogWriter() throws SQLException { > > return DriverManager.getLogWriter(); > > } > > > > public void setLoginTimeout(int timeout) throws SQLException { > > DriverManager.setLoginTimeout(timeout); > > } > > > > public void setLogWriter(PrintWriter writer) throws SQLException { > > DriverManager.setLogWriter(writer); > > } > > > > } > > > > --- NEW FILE: MySQLDataSource.java --- > > > /*************************************************************************** > *** > > * JSPDBAdmin: Software to maintain and administrate Databases > * > > * Copyright (C) 2001 Adrian Almenar > * > > * > * > > * This program is free software; you can redistribute it and/or modify > * > > * it under the terms of the GNU General Public License as published by > * > > * the Free Software Foundation; either version 2 of the License, or > * > > * (at your option) any later version. > * > > * > * > > * This program is distributed in the hope that it will be useful, > * > > * but WITHOUT ANY WARRANTY; without even the implied warranty of > * > > * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > * > > * GNU General Public License for more details. > * > > * > * > > * You should have received a copy of the GNU General Public License > * > > * along with this program; if not, write to the Free Software > * > > * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 > USA * > > > **************************************************************************** > **/ > > > > /* > > * $Id: MySQLDataSource.java,v 1.1 2002/08/08 05:01:51 aalmenar Exp $ > > * $Date: 2002/08/08 05:01:51 $ > > */ > > > > package org.jspdbadmin.util.jdbc; > > > > import java.io.PrintWriter; > > import java.sql.*; > > import javax.sql.*; > > > > /***************************************************************** > > * This class only implements <code>DataSource</code> for MySQL > > * <b>TODO: (Need to be more specific here)</b> > > * @author <a href="mailto:aal...@ca...">Adrian Almenar</a> > > * @version $Revision: 1.1 $ > > *****************************************************************/ > > public class MySQLDataSource implements DataSource { > > > > public static { > > //FIXME NEED TO CHECK WHAT IS CORRECT > > new org.gjt.mm.mysql.Driver(); > > //Class.forName("org.gjt.mm.mysql.Driver").newInstance(); > > } > > > > protected boolean usingThinDriver; > > protected String description = "MySQL Datasource"; > > protected String serverName; > > protected int portNumber; > > protected String databaseName; > > > > > > public MySQLDataSource(String host, int port, String sid) { > > setServerName(host); > > setPortNumber(port); > > setDatabaseName(sid); > > } > > > > public String getDescription() { > > return description; > > } > > > > public void setDescription(String desc) { > > description = desc; > > } > > > > public String getServerName() { > > return serverName; > > } > > > > public void setServerName(String name) { > > serverName = name; > > } > > > > public int getPortNumber() { > > return portNumber; > > } > > > > public void setPortNumber(int port) { > > portNumber = port; > > } > > > > public String getDatabaseName() { > > return databaseName; > > } > > > > public void setDatabaseName(String name) { > > databaseName = name; > > } > > > > public Connection getConnection() throws SQLException{ > > return getConnection(null, null); > > } > > > > public Connection getConnection(String userid, String password) throws > SQLException { > > String url = "jdbc:mysql://" + getSubname()+"?" + userid +"&"+ > password; > > return DriverManager.getConnection(url); > > } > > > > protected String getSubname() { > > return (getServerName() + ":" + getPortNumber() +"/"+ > getDatabaseName()); > > } > > > > public int getLoginTimeout() throws SQLException { > > return DriverManager.getLoginTimeout(); > > } > > > > public PrintWriter getLogWriter() throws SQLException { > > return DriverManager.getLogWriter(); > > } > > > > public void setLoginTimeout(int timeout) throws SQLException { > > DriverManager.setLoginTimeout(timeout); > > } > > > > public void setLogWriter(PrintWriter writer) throws SQLException { > > DriverManager.setLogWriter(writer); > > } > > > > } > > > > > > > > ------------------------------------------------------- > > This sf.net email is sponsored by:ThinkGeek > > Welcome to geek heaven. > > http://thinkgeek.com/sf > > _______________________________________________ > > JSPDBAdmin-Developers mailing list > > JSP...@li... > > https://lists.sourceforge.net/lists/listinfo/jspdbadmin-developers > > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > JSPDBAdmin-Developers mailing list > JSP...@li... > https://lists.sourceforge.net/lists/listinfo/jspdbadmin-developers > |