now problem is, when this cmd is executed a db2 console is opened (which is fine) but java losses the control of it and there is no way to find out if the table creation is over and wether it was success or failure, even process.waitFor() doesnot wait and process.exitValue() gives 0 (i,e sucess)
All desirable things in life are either illegal, banned, expensive or married to someone else !!!
ashu Suri wrote:Try StreamGobblers.
This should solve your problem.
The problem is that db2cmd opens a new window. So if you open a standard Windows command prompt, and type
db2cmd a new window with the required DB2 environment initialised will pop up. You won't be able to access stdout and stderr used in that window.
Joined: Feb 10, 2001
this did not work, the exit value '0' is printed even if db2cmd window is still opening..
okay about running ddl , yeha i can , in this case i am creating database in db2, which i doubt is possible using jdbc.
Joined: May 06, 2010
Praful Thakare wrote:okay about running ddl , yeha i can , in this case i am creating database in db2, which i doubt is possible using jdbc.
If you had read the article I had linked, you would have found it is possible with some databases and not with others - don't know about DB2, but it's worth a try, especially when the other way, via exec(), does not work. Hmm?
Creating a database. A database can be created using tools supplied by the database vendor, or via SQL statements fed to the database from a Java program. Since there is normally a database administrator (of course, as a developer, this may be you), and not all JDBC drivers support database creation through Data Definition Language ( DDL), this topic will, in general, be left as DBMS (DataBase Management System) and driver specific. If you are interested in more details, there typically is a CREATE DATABASE statement, but be sure to review your DBMS SQL reference, as it is not part of the SQL standard, but is DBMS-dependent.
Joined: Feb 10, 2001
Thanks for your comments Istvan, though i have some different requirement of creating entire environment, db, app server,messaging q etc using on program henc ei am using java runtime, any ways fond the solution, incase some one stumbles here in future.