You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by bl...@apache.org on 2001/01/12 16:26:00 UTC
cvs commit: xml-cocoon/src/org/apache/cocoon/components/datasource JdbcDataSource.java
bloritsch 01/01/12 07:26:00
Modified: src/org/apache/cocoon/acting Tag: xml-cocoon2
UpdEmployeeAction.java
src/org/apache/cocoon/components/datasource Tag: xml-cocoon2
JdbcDataSource.java
Log:
Fixed JdbcDataSource so that optional parameters can be optional.
Revision Changes Path
No revision
No revision
1.1.2.5 +5 -5 xml-cocoon/src/org/apache/cocoon/acting/Attic/UpdEmployeeAction.java
Index: UpdEmployeeAction.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/acting/Attic/UpdEmployeeAction.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- UpdEmployeeAction.java 2001/01/11 21:04:14 1.1.2.4
+++ UpdEmployeeAction.java 2001/01/12 15:25:59 1.1.2.5
@@ -33,7 +33,7 @@
/**
*
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.4 $ $Date: 2001/01/11 21:04:14 $
+ * @version CVS $Revision: 1.1.2.5 $ $Date: 2001/01/12 15:25:59 $
*/
public class UpdEmployeeAction extends ComposerAction {
@@ -81,10 +81,10 @@
conn = datasource.getConnection();
conn.setAutoCommit(false);
- ps = conn.prepareStatement("UPDATE employee_table SET id = ?, name = ?, department_id = ?");
- ps.setString(1, id);
- ps.setString(2, name);
- ps.setString(3, department);
+ ps = conn.prepareStatement("UPDATE employee_table SET name = ?, department_id = ? WHERE id = ?");
+ ps.setString(1, name);
+ ps.setString(2, department);
+ ps.setString(3, id);
ps.executeUpdate();
returnValue = true;
No revision
No revision
1.1.2.7 +14 -4 xml-cocoon/src/org/apache/cocoon/components/datasource/Attic/JdbcDataSource.java
Index: JdbcDataSource.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/datasource/Attic/JdbcDataSource.java,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -r1.1.2.6 -r1.1.2.7
--- JdbcDataSource.java 2001/01/10 22:07:04 1.1.2.6
+++ JdbcDataSource.java 2001/01/12 15:26:00 1.1.2.7
@@ -22,7 +22,7 @@
* <code>java.sql.DriverManager</code>.
*
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.1.2.6 $ $Date: 2001/01/10 22:07:04 $
+ * @version CVS $Revision: 1.1.2.7 $ $Date: 2001/01/12 15:26:00 $
*/
public class JdbcDataSource implements DataSourceComponent {
Logger log = LogKit.getLoggerFor("cocoon");
@@ -42,12 +42,22 @@
throws ConfigurationException {
if (this.pool == null) {
String dburl = conf.getChild("dburl").getValue();
- String user = conf.getChild("user").getValue();
- String passwd = conf.getChild("password").getValue();
+ Configuration userConf = conf.getChild("user");
+ Configuration passwdConf = conf.getChild("password");
+ String user = null;
+ String passwd = null;
+ if (! userConf.getLocation().equals("-")) {
+ user = userConf.getValue();
+ }
+
+ if (! passwdConf.getLocation().equals("-")) {
+ passwd = passwdConf.getValue();
+ }
+
Configuration controler = conf.getChild("pool-controller");
int min = controler.getAttributeAsInt("min", 0);
- int max = controler.getAttributeAsInt("max", 1);
+ int max = controler.getAttributeAsInt("max", 3);
this.pool = new JdbcConnectionPool(dburl, user, passwd, min, max);
}