| Author | 
		  Message
		 | 
		
		  | matuwe | 
		  
		    
			  
				 Posted: Mon Dec 13, 2010 2:28 am    Post subject: Java compute : PASSTHRU not working JDBC | 
				     | 
			   
			 
		   | 
		
		
		    Master
 
 Joined: 05 Dec 2007 Posts: 296
  
  | 
		  
		    
			  
				I need to use PASSTHRU inside my java compute node and use my JDBC connection. My sqlstatement is SELECT colname from ABC where ? and at runtime I send the value of ?
 
 
 
I am not sure if I am doing it right
 
 
1.  Can I have PASSTHRU connecting via JDBC
 
2.  Can I send values to PASSTHRU at runtime, like I would in ESQL file
 
 
   
	| Code: | 
   
  
	
 
System.out.println(data2);
 
statement = "PASSTHRU('" + precondition1 + "'," +ff.getValueAsString()+ ");";
 
MbSQLStatement stmt22 = createSQLStatement("MYJDBC", statement);
 
         //   boolean rs = stmt22.execute();
 
 | 
   
 
 | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Mon Dec 13, 2010 2:54 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				I don't think you can use PASSTHRU with a JDBC connection.
 
 
I don't think you need to use PASSTHRU with a JDBC connection, as JDBC does not have an ESQL Select in the first place, and always and only runs the native DB Select statement. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kash3338 | 
		  
		    
			  
				 Posted: Mon Dec 13, 2010 3:04 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Shaman
 
 Joined: 08 Feb 2009 Posts: 709 Location: Chennai, India 
  | 
		  
		    
			  
				| Since you are trying to connect to JDBC from your Java code, you dont require a PASSTHRU. You can use JDBC API's to do the same and refer to some sample Java codes to do this. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | fjb_saper | 
		  
		    
			  
				 Posted: Mon Dec 13, 2010 5:50 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 18 Nov 2003 Posts: 20768 Location: LI,NY 
  | 
		  
		    
			  
				your where clause in your SQL statement is malformed:
 
   
	| Quote: | 
   
  
	| Select column from abc where ? | 
   
 
 
You are missing the other part of your where condition... 
 
It should read something like: "where field = ?"   _________________ MQ & Broker admin | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | matuwe | 
		  
		    
			  
				 Posted: Mon Dec 13, 2010 6:00 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Master
 
 Joined: 05 Dec 2007 Posts: 296
  
  | 
		  
		    
			  
				Hi I wanted to use the PASSTHRU format, and use ? as place holders for my values. I used to send an array into the PASSTHRU and it knew how to replace all ? with the correct value. 
 
 
 
Now I am trying
 
 
stmt = conn.prepareStatement(precondition1) ;
 
stmt.setString(1,ff.getValueAsString());
 
 
But it seems like I need to know what the datatype should be for each parameter. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | fjb_saper | 
		  
		    
			  
				 Posted: Mon Dec 13, 2010 6:07 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 18 Nov 2003 Posts: 20768 Location: LI,NY 
  | 
		  
		    
			  
				Yes you do need to match the condition type with the parameter type. _________________ MQ & Broker admin | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |