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 » inserting data into DB

Post new topic  Reply to topic Goto page 1, 2  Next
 inserting data into DB « View previous topic :: View next topic » 
Author Message
indu30111986
PostPosted: Thu Jan 05, 2012 10:30 pm    Post subject: inserting data into DB Reply with quote

Novice

Joined: 15 Nov 2011
Posts: 22

INSERT INTO Database.Indu.TABLE1(ID,NAME,ROLE) VALUES ('4','AAA','Tester');


i am trying to insert the above data into the table1 but its not getting inserted.

i have created a table1 as below.

Name Null? Type
----------------------------------------- -------- --------------

ID VARCHAR2(10)
NAME VARCHAR2(20)
ROLE VARCHAR2(20)
Back to top
View user's profile Send private message
ruchir123
PostPosted: Thu Jan 05, 2012 11:38 pm    Post subject: Reply with quote

Acolyte

Joined: 04 Jan 2012
Posts: 58

Hi Indu,

I think in your code Indu is your Datasource name.

try your code just by using Database...... as:

insert into Database.TABLE1(ID,NAME,ROLE) VALUES('4','aaa','Tester');
Back to top
View user's profile Send private message
indu30111986
PostPosted: Fri Jan 06, 2012 1:28 am    Post subject: Reply with quote

Novice

Joined: 15 Nov 2011
Posts: 22

hi ruchir123


Still it is not working...i am not able to insert in the DB

INSERT INTO Database.TABLE1(ID,NAME,ROLE) VALUES ('4','AAA','Tester');

pls suggest.
Back to top
View user's profile Send private message
ruchir123
PostPosted: Fri Jan 06, 2012 2:44 am    Post subject: Reply with quote

Acolyte

Joined: 04 Jan 2012
Posts: 58

Hi Indu,

Code seems to be correct.
Try using
Code:
COMMIT;

after your insert statement.
If still it didnt work then please check your DSN or database.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Fri Jan 06, 2012 2:45 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

What does a usertrace show?
How do you know it is not working?
What have you done to prove this fact?
does the ODBC connection work?

Have you looked for other similar posts in this forum? There are many?
If you did look, what did you learn from them?
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
indu30111986
PostPosted: Fri Jan 06, 2012 2:56 am    Post subject: Reply with quote

Novice

Joined: 15 Nov 2011
Posts: 22

i am new to WMB.
i am not aware of the user trace.
I have debugged my flow.When i tested with a message in the input queue the message was processed and sent to the output queue.I am confiring this by montitoring the CURDEPTH count in the MQ explorer window.
I ahve tested the ODBC connection with DSN it is working fine.

my entire code is here

CREATE COMPUTE MODULE sample_DBconn_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN

DECLARE CONTINUE HANDLER FOR SQLSTATE LIKE '%' BEGIN END;
CALL CopyEntireMessage();
DELETE FIELD OutputRoot.*[<];
INSERT INTO Database.TABLE1(ID,NAME,ROLE) VALUES ('4','AAA','Tester');
SET OutputRoot.XML.Test.Result[] = (SELECT T.* FROM Database.Indu.TABLE1 AS T);
RETURN TRUE;
END;

CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
END MODULE;
Back to top
View user's profile Send private message
ruchir123
PostPosted: Fri Jan 06, 2012 3:16 am    Post subject: Reply with quote

Acolyte

Joined: 04 Jan 2012
Posts: 58

Hi Indu,

In your code you are selecting just after inserting in your database.
Please check if data is inserted directly from database. Also try using COMMIT in your code after INSERT statement, then you can fetch data from your databse.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Fri Jan 06, 2012 3:46 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

ruchir123 wrote:
Also try using COMMIT in your code after INSERT statement, then you can fetch data from your databse.


DO NOT DO THIS unless you really know what you are doing.
The flow is (unless you configure it otherwise) is TRANSACTIONAL. This means that there is an implicit commit done at the end of the operation/thread.

Please tell whoever is giving you these tasks that you really need some formal training in message broker development. This way you will learn what is good and what is not best practices.

Broker is NOT a simple product to learn. You need to know about a whole host of other things (ie Databases, XSD's WSDL's, etc) that broker interfaces with to make it work properly. Attending a formal training session is the first rung on the ladder to becoming a competent developer.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Jan 06, 2012 5:37 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

smdavies99 wrote:
ruchir123 wrote:
Also try using COMMIT in your code after INSERT statement, then you can fetch data from your databse.


DO NOT DO THIS unless you really know what you are doing.




Do not try and override WMB's transaction control like this unless you're clear on all the consequences and have coded for them.

If you're as new with WMB as you claim don't do it.

You'll find the usertrace described in the production documentation and discussed extensively on this forum.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
ruchir123
PostPosted: Fri Jan 06, 2012 9:47 am    Post subject: Reply with quote

Acolyte

Joined: 04 Jan 2012
Posts: 58

hi,

I am sorry if i didn't suggested the right way to do it. Actually i did so because according to Indu's code in the first statement Indu is inserting in database and in the next statement fetching from the database so i thought it may solve the issue.So i suggested this way.

Anyways thanks for sharing the knowledge. Thanks for your support
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Jan 06, 2012 10:03 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

ruchir123 wrote:
Actually i did so because according to Indu's code in the first statement Indu is inserting in database and in the next statement fetching from the database so i thought it may solve the issue.


Depending on the database in use (which we don't know) it might work. But it might not.

It's certainly a rather odd piece of code.

You got jumped on not because it's the "wrong" way to do it specifically, but because it's potentially dangerous, like using a WMQ queue directly rather through a WMB node. Inexperienced posters could be misled and remember these threads remain on the forum so can be found months or years from now via Google.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
ruchir123
PostPosted: Sun Jan 08, 2012 9:18 am    Post subject: Reply with quote

Acolyte

Joined: 04 Jan 2012
Posts: 58

Hi Vitor,

you are right that inexperienced posters could be mislead but one only becomes experienced after posting. I realized i did mistake, so i apologized for that.
And thanks to experts like you who tell us where we make mistakes so that we can be right.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Sun Jan 08, 2012 10:07 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

ruchir123 wrote:
you are right that inexperienced posters could be mislead but one only becomes experienced after posting


There is absolutely no correlation between postcount and expertise.

Expertise comes from rigorous application of professional standards and practices, including continual self-education, experimentation, and simple hard work.
Back to top
View user's profile Send private message
vennela
PostPosted: Sun Jan 08, 2012 10:33 am    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

So, to answer your question, I think we need to know
What kind of database are you using (DB2 or Oracle) etc
Any other important information, like what schema does TABLE1 reside under
Along with those product versions like MQ and MB versions with fix pack level will be helpful in answering
Back to top
View user's profile Send private message Send e-mail Visit poster's website
indu30111986
PostPosted: Mon Jan 09, 2012 2:59 am    Post subject: Reply with quote

Novice

Joined: 15 Nov 2011
Posts: 22

DB used is Oracle 10g

Schema Name is Indu
Version is 7.0
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » inserting data into DB
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.