[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1241
  • Last Modified:

DB2 installation - Silent install plus create database

Hello,

I am very new to DB2 but I am hoping this is common enough that it is simple to do.

I want to create a silent install for DB2 Express C database on a windows machine such that it installs the typical database with the LocalSystem as the user.  Once DB2 is installed I want to create a script that creates a database with two tables.

Basically I need this to be very simple installation for people who know very little about databases.

I am not even sure where to start as I have been searching for 2 hours.

I have a response file that I created (which I think is ok) but I do not see a way to create a database after DB2 installs.

Thanks for any advice/direction.

MAC
0
mac-will
Asked:
mac-will
  • 3
  • 2
1 Solution
 
Kent OlsenData Warehouse Architect / DBACommented:
Hi Mac,

Installing DB2 and creating a database are separate processes.  Once DB2 is installed, it's nearly trivial to create a database and a couple of tables.  Just create the DDL and run it through the command line processor.

Installing DB2 isn't quite so simple.  There are installation options that must be resolved, such as file locations, controlling users, etc.

The DB2 installation isn't tough, particularly if you've got a guide to help you with the decisions, but I'm not aware of there being a true "silent install" available.


Kent
0
 
mac-willAuthor Commented:
Hi Kent.

Thanks!

So if I have say a batch file I can run the "setup -u <response file>" command followed by??

An SQL script to create the DB, connect to it and create the tables?

Thanks

MAC
0
 
Kent OlsenData Warehouse Architect / DBACommented:
You can do something very similar.

Create a file with the required commands.

CREATE DATABASE mydatabase
CONNECT TO mydatebase
CREATE TABLE Names (ID integer IDENTITY generated by default, NAME varchar(40))
CREATE TABLE Addresses (ID integer IDENTITY generated by default, ADDRESS1 varchar(30), ADDRESS2 varchar(30))

Then run that through the CLI.  

Kent
0
 
mac-willAuthor Commented:
Thanks again Kent.

If this is something that will be deployed to several independent machines is it wise to create a schema first? something like:

CREATE DATABASE mydatabase
CONNECT TO mydatebase

CREATE SCHEMA mySchema AUTHORIZATION GUEST;

CREATE TABLE  mySchema.Names (ID integer IDENTITY generated by default, NAME varchar(40))
CREATE TABLE  mySchema.Addresses (ID integer IDENTITY generated by default, ADDRESS1 varchar(30), ADDRESS2 varchar(30))

And AUTHORIZATION GUEST seems to have no effect on my machine, do you know what this does?

Thanks again

MAC
0
 
Kent OlsenData Warehouse Architect / DBACommented:
That's an advanced topic probably well beyond what you're going to need.  In a nutshell, it changes the current user authorization to the permissions of user 'GUEST'.

If you want to read more about it, the IBM documentation is here:

  http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp?topic=/com.ibm.sqls.doc/sqls806.htm

It's probably better to read the IBM literature than have me paraphrase up a long description.  :)


Kent
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now