A Simple JNI program to List DSNs RegisteredThis Java Program makes use of a DLL created by previous VC++ example and lists DSNs in a Windows box.Java doing some system side activities? It uses the dll, created using MS VC++.Win Zipped dll Source of the dll are here. Warning:This program is completely Platform dependent. ;o)
class DSNList
{
public native String getNativeDSNList(int type);
static{
System.loadLibrary("DSNlist");
}
public static void main(String[] args)
{
String list ="";
list = new DSNList().getNativeDSNList(0);
//0-System dsn.
//1-User dsn
///return value is a string separated by '?'
java.util.StringTokenizer stoken = new java.util.StringTokenizer(list,"?");
while(stoken.hasMoreTokens()){
String item = stoken.nextToken();
System.out.println(item);
}
}
}
|