Click to See Complete Forum and Search --> : java, SQL, DB2.. Help!


mike
02-14-2001, 11:14 AM
Hello.
Ultimately i want my java program that i am writing to connect to a db2 database,
create a whole new database (not just a table) and fill the database with
a whole lot of data that is predefined.
I have given up trying to make my java program take control of the command
line processor, and have decided to just do it 100% using java. Everywhere
I look on the internet tells me how to execute SELECT statements in java,
but thats not what i want. I need to know how to actually create a whole
new database. In the command line processor , the command
"create db database_name" works fine. Thats why I originaly tried to make
my program use the DB2 command line processor somehow. that didnt work out
though. I cannot, no matter how hard i try, accomplish the same task using
java, and i need help!

Here are some of my code snippets that might be relevant:

Class.forName( "COM.ibm.db2.jdbc.app.DB2Driver");
String sURL = "jdbc:db2:SAMPLE";
con = DriverManager.getConnection ( sURL,"_user_", "_pass_");
stmt = con.createStatement();

stmt.execute("create db temp");

I know this last line doesnt do the job, and i have tried tons of variations
on it.

If someone doesnt understand what exactly im asking, please let me know,
because this is pretty important. Ive been working on this for a long time
and i dont want to waste any more time trying to figure it out.

Thanks!