Skip to content

Instantly share code, notes, and snippets.

View angoca's full-sized avatar
🏠
Working from home

Andres Gomez Casanova angoca

🏠
Working from home
View GitHub Profile
@angoca
angoca / Look_For_Object.sql
Last active December 28, 2015 03:19
How to look up for a object in DB2 and know what kind of object it is. It is called like this: db2 "call LOOK_FOR_OBJECT('NULLID','SQLC2H21')"
CREATE OR REPLACE PROCEDURE LOOK_FOR_OBJECT (
IN SCHEM VARCHAR(256),
IN NAME VARCHAR(256)
)
LANGUAGE SQL
SPECIFIC PRO_LOOK_FOR_OBJECT
DYNAMIC RESULT SETS 1
READS SQL DATA
DETERMINISTIC
NO EXTERNAL ACTION
@angoca
angoca / db2env
Created August 20, 2013 10:01
Change between multiple DB2 instances in the same server. It has two modes, interactive or with parameter. The script is written in bash for DB2 9.7 but it can be used in any previous or more recent version.
#!/bin/bash
# Changes the environment to the given DB2 instance.
#
# You need to 'source' this command in order to change the environement.
# To ease the process, you can create a function per instance in the .profile.
#
# function i01 { . ${CHINS} db2inst1 ; }
#
# To configure, you just need to change the DB2 path.
@angoca
angoca / db2cksec
Last active September 22, 2016 16:55
Checks the security in DB2 (authorities at instance and database level)
#!/bin/bash
# The MIT License (MIT)
#
# Copyright (c) 2014 Andres Gomez Casanova
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@angoca
angoca / chins
Created May 28, 2013 16:13
Instance changer for a db2 server When you have a DB2 server, with many instances, and you have to work in all of them from the same user, this is a useful script that allows you to switch effeiciently from one environment to the other. You just need to put the file in any directory of your server, configure the directories (Instance home and in…
#!/usr/bin/ksh
# Changes the environment to the given instance.
# You need to 'source' this command in order to change the environement.
# To ease the process, you can create an alias per instance in the .profile.
# alias i1=". ~/chins db2inst1"
#set -x
@angoca
angoca / TweetTable.java
Created February 29, 2012 20:18
Access Twitter from DB2 via a select
import java.util.Iterator;
import twitter4j.Query;
import twitter4j.QueryResult;
import twitter4j.Tweet;
import twitter4j.Twitter;
import twitter4j.TwitterFactory;
import COM.ibm.db2.app.UDF;
/**