db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r330547 - in /db/derby/code/trunk/java: testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ tools/org/apache/derby/impl/tools/ij/
Date Thu, 03 Nov 2005 13:31:44 GMT
Author: kmarsden
Date: Thu Nov  3 05:31:36 2005
New Revision: 330547

URL: http://svn.apache.org/viewcvs?rev=330547&view=rev
Log:
DERBY-648 ij 'show connections' statement does not work in JSR169
Remove getUrl call for show connections with J2ME

Contributed by Deepa Remesh


Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/secureUsers_app.properties
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/users2_app.properties
    db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/secureUsers_app.properties
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/secureUsers_app.properties?rev=330547&r1=330546&r2=330547&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/secureUsers_app.properties
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/secureUsers_app.properties
Thu Nov  3 05:31:36 2005
@@ -13,7 +13,4 @@
 ij.dataSource.databaseName=wombat
 ij.dataSource.createDatabase=create
 ij.dataSource.user=system
-ij.dataSource.password=manager
-
-#Exclude for J2ME/Foundation - test requires java.sql.DriverManager
-runwithfoundation=false
+ij.dataSource.password=manager
\ No newline at end of file

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/users2_app.properties
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/users2_app.properties?rev=330547&r1=330546&r2=330547&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/users2_app.properties
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/users2_app.properties
Thu Nov  3 05:31:36 2005
@@ -11,7 +11,4 @@
 ij.dataSource.databaseName=wombat
 ij.dataSource.createDatabase=create
 ij.dataSource.user=system
-ij.dataSource.password=manager
-
-#Exclude for J2ME/Foundation - test requires java.sql.DriverManager
-runwithfoundation=false
\ No newline at end of file
+ij.dataSource.password=manager
\ No newline at end of file

Modified: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj?rev=330547&r1=330546&r2=330547&view=diff
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj (original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj Thu Nov  3 05:31:36
2005
@@ -466,62 +466,73 @@
         return array;
 	}
 
-        /**
+	    /**
 	  This is used at the ij startup time to see if there are already some
-          connections made and if so, show connections made so far.
+	      connections made and if so, show connections made so far.
 	  Following also gets executed when user types show connections command
-          in ij. In the former case, ignore0Rows is set whereas in the later cas
+	      in ij. In the former case, ignore0Rows is set whereas in the later cas
 	  it's set to false. The reason for this is, at ij startup time, if there
 	  are no connections made so far, we don't want to show anything. Only if
 	  there are connections made, we show the connections. Whereas in show
 	  connection command case, we want to show the connection status either way
 	  ie if there are no connections, we say no connections. Otherwise we list
 	  all the connections made so far.
-        */
+	    */
 	public ijResult showConnectionsMethod(boolean ignore0Rows) throws SQLException {
-  	  Hashtable ss = currentConnEnv.getSessions();
-	  Vector v = new Vector();
-	  SQLWarning w = null;
-          if (ss == null || ss.size() == 0) {
-             if (!ignore0Rows)
-                v.addElement(LocalizedResource.getMessage("IJ_NoConneAvail"));
-          } else {
-            boolean haveCurrent=false;
-	    int count = 0;
-	    for (Enumeration connectionNames = ss.keys(); connectionNames.hasMoreElements();
-				connectionNames.nextElement()) 
-		    count++;
+  		Hashtable ss = currentConnEnv.getSessions();
+	  	Vector v = new Vector();
+	  	SQLWarning w = null;
+        if (ss == null || ss.size() == 0) {
+        	if (!ignore0Rows)
+            	v.addElement(LocalizedResource.getMessage("IJ_NoConneAvail"));
+        } 
+        else {
+        	boolean haveCurrent=false;
+			int count = 0;
+			for (Enumeration connectionNames = ss.keys(); connectionNames.hasMoreElements();
+						connectionNames.nextElement()) 
+		    	count++;
             String[] array = sortConnectionNames();
-	    for ( int ictr = 0; ictr < count; ictr++ ) {
-			String connectionName = array[ ictr ];
-                Session s = (Session)ss.get(connectionName);
-                if (s.getConnection().isClosed()) {
-                   if (currentConnEnv.getSession() != null && connectionName.equals(currentConnEnv.getSession().getName()))
{
-                      currentConnEnv.removeCurrentSession();
-                      theConnection = null;
-                   } else
-                     currentConnEnv.removeSession(connectionName);
-                } else {
-                  StringBuffer row = new StringBuffer();
-                  row.append(connectionName);
-                  if (currentConnEnv.getSession() != null && connectionName.equals(currentConnEnv.getSession().getName()))
{
-                     row.append('*');
-                     haveCurrent=true;
-                  }
-                  row.append(" - 	");
-                  row.append(s.getConnection().getMetaData().getURL());
-                  // save the warnings from these connections
-                  w = appendWarnings(w,s.getConnection().getWarnings());
-                  s.getConnection().clearWarnings();
-                  v.addElement(row.toString());
-                }
-            }
-  	    if (haveCurrent)
-               v.addElement(LocalizedResource.getMessage("IJ_CurreConne"));
-	    else
-               v.addElement(LocalizedResource.getMessage("IJ_NoCurreConne"));
-	  }
-	  return new ijVectorResult(v,w);
+		    for ( int ictr = 0; ictr < count; ictr++ ) {
+				String connectionName = array[ ictr ];
+            	Session s = (Session)ss.get(connectionName);
+            	if (s.getConnection().isClosed()) {
+            		if (currentConnEnv.getSession() != null && 
+            				connectionName.equals(currentConnEnv.getSession().getName())) {
+                  		currentConnEnv.removeCurrentSession();
+                  		theConnection = null;
+               		}
+	               	else
+    	            	currentConnEnv.removeSession(connectionName);
+            	}
+            	else {
+            		StringBuffer row = new StringBuffer();
+	              	row.append(connectionName);
+              		if (currentConnEnv.getSession() != null && 
+              			connectionName.equals(currentConnEnv.getSession().getName())) {
+		               	row.append('*');
+                 		haveCurrent=true;
+              		}
+              
+		    	  	//If ij.dataSource property is set, show only connection names.
+		    	  	//In this case, URL is not used to get connection, so do not append URL
+	    		  	String dsName = util.getSystemProperty("ij.dataSource");
+				  	if(dsName == null){	
+                		row.append(" - 	");
+	              		row.append(s.getConnection().getMetaData().getURL());
+	          		}
+              		// save the warnings from these connections
+	              	w = appendWarnings(w,s.getConnection().getWarnings());
+    	          	s.getConnection().clearWarnings();
+        	      	v.addElement(row.toString());
+            	}
+        	}
+  	    	if (haveCurrent)
+            	v.addElement(LocalizedResource.getMessage("IJ_CurreConne"));
+		    else
+            	v.addElement(LocalizedResource.getMessage("IJ_NoCurreConne"));
+	  	}
+	  	return new ijVectorResult(v,w);
 	}
 
 



Mime
View raw message