Author: Steve

java dynamic SQL formatter

import java.sql.*; public class dynColumns { public static void main(String[] args) { try { Connection con = DriverManager.getConnection(“jdbc:oracle:thin:” + args[0]); Statement stm = con.createStatement(); ResultSet rst = stm.executeQuery(args[1]); ResultSetMetaData rstMeta = rst.getMetaData(); int columns = rstMeta.getColumnCount(); while (rst.next()) { for…

SAML response between IDP and SP

samlresponse sent from idp back to browser, who posts via form to service provider. the response is encrypted with the public key of the service provider Usually, the SP creates a SAML request, and also creates a form whose action…

Does BlockingQueue.take() use CPU?

No… [root@cmhlcarchapp01 ~]# cat t.java import java.util.concurrent.*; public class t implements Runnable { static ArrayBlockingQueue Q = new ArrayBlockingQueue(5); String type; public static void main (String args[]) { t n = new t(“producer”); t n2 = new t(“consumer”); } public…

Spark in python

Just a simple example to get started. #./pyspark –jars /tmp/mysql-connector-java-5.1.45-bin.jar Welcome to ____ __ / __/__ ___ _____/ /__ _\ \/ _ \/ _ `/ __/ ‘_/ /__ / .__/\_,_/_/ /_/\_\ version 1.5.2 /_/ Using Python version 2.6.6 (r266:84292, Jan…

Oracle pipelined function

It sounds like you guys have a solution, but I wanted a POC for this that we could check into our library, so I came up with this… SQL> create or replace type expr_skulist_type as object(skulist number, 2 item varchar2(25),…

Getting SQL Server table size with Powershell

$conn = New-Object System.Data.SqlClient.SqlConnection $conn.ConnectionString = “Server=********\NCRWO;database=NCRWO_TransactionLog;Integrated Security=true;MultipleActiveResultSets=true” $conn.Open() $cmd = New-Object System.Data.SqlClient.SqlCommand $cmdInner = New-Object System.Data.SqlClient.SqlCommand $cmd.Connection = $conn $cmdInner.Connection = $conn $cmd.CommandText = “SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE=’BASE TABLE'” $swReader = $cmd.ExecuteReader() while ($swReader.Read()) { $cmdInner.CommandText =…

Listing all queues in ActiveMQ

This still has an issue with getting a consistent read. I will update this once I figure that piece out… import org.apache.activemq.*; import java.util.*; import org.apache.activemq.advisory.DestinationSource; import javax.jms.*; import javax.naming.*; import org.apache.activemq.*; import org.apache.activemq.command.ActiveMQQueue; public class ListQueues { public static…

JBOSS – Changing connection pool size with JMX

Enable password in JBOSS_HOME/server/JBOSS_SERVER_NAME/conf/props/jmx-console-users.properties You can then punch in bean calls such as the following… [sa-jboss@servername ~]$ /usr/local/jboss/bin/twiddle.sh –server=servername:1599 -u admin -p admin get “jboss.jca:service=ManagedConnectionPool,name=atgcatalogb_ds” MinSize MinSize=10 [sa-jboss@servername ~]$ /usr/local/jboss/bin/twiddle.sh –server=servername:1599 -u admin -p admin set “jboss.jca:service=ManagedConnectionPool,name=atgcatalogb_ds” MinSize 40 MinSize=40…