ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Java compute : PASSTHRU not working JDBC

Post new topic  Reply to topic
 Java compute : PASSTHRU not working JDBC « View previous topic :: View next topic » 
Author Message
matuwe
PostPosted: Mon Dec 13, 2010 2:28 am    Post subject: Java compute : PASSTHRU not working JDBC Reply with quote

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
View user's profile Send private message
mqjeff
PostPosted: Mon Dec 13, 2010 2:54 am    Post subject: Reply with quote

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
View user's profile Send private message
kash3338
PostPosted: Mon Dec 13, 2010 3:04 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
fjb_saper
PostPosted: Mon Dec 13, 2010 5:50 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
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
View user's profile Send private message Send e-mail
matuwe
PostPosted: Mon Dec 13, 2010 6:00 am    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Mon Dec 13, 2010 6:07 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Yes you do need to match the condition type with the parameter type.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Java compute : PASSTHRU not working JDBC
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.