Search This Blog

Monday, July 30, 2012

JNI - get method signature

sometimes when you mixed java and C++ code you must used JNI.
So the best way to find the method signature is via javap application that exist in JAVA jdk.

in case you want to see the method  signature to initialize your jmethodID  follow the next steps:

  1. open command windows
  2. navigate to your class directory (where the class file exist, e.g. c:\xxx\bin\com\)
  3. run the javap.exe -c -s [class name]    ( without the .class e.g. javap -c -s myclass)
make sure your javap is in the PATH , or write the full path to it.

enjoy
Yaniv Tzanany

Tuesday, July 3, 2012

JAVA thread dump on linux

in case you want to see the thread dump of running java process , even the call stack of stuck program.
open new console and run the next command

kill -3 [pid] 

you should see some good info in the console/stdout  of the running process.

Yaniv T

Monday, July 2, 2012

Connect to SQL Server from Linux via ODBC


unixODBC (it’s a driver manager) and  should be our choice , on top of it we should plug a driver and we can find the  MS-SQL driver from Microsoft.
More details about this one could be found here http://msdn.microsoft.com/en-us/library/hh335190(v=sql.10)
From FAQ

The first version of the driver is a 64 bit
 This release supports Red Hat Enterprise Linux 5 and Red Hat Enterprise Linux 6 connecting to SQL Server 2008, SQL Server 2008 R2, and SQL Server 2012.

So if we are ok with the above restriction  … we can go forward with this driver.
We can Download the Microsoft ODBC for Linux from http://www.microsoft.com/en-us/download/details.aspx?id=28160

you can use Existing MSDN C++ ODBC Samples for Microsoft Linux ODBC Driver as described here http://blogs.msdn.com/b/sqlblog/archive/2012/01/26/use-existing-msdn-c-odbc-samples-for-microsoft-linux-odbc-driver.aspx
enjoy 
Yaniv Tzanany