1 package nmp.dbms.util;
2
3 public class ODBCUtil {
4 static {
5 System.loadLibrary( "nmp/dbms/util/ODBCUtil");
6 }
7
8 /***
9 * Type parameter in SQLConfigDataSource
10 */
11 public static final short ODBC_ADD_DSN = 1; // Add data source
12 public static final short ODBC_CONFIG_DSN = 2; // Configure (edit) data source
13 public static final short ODBC_REMOVE_DSN = 3; // Remove data source
14 public static final short ODBC_ADD_SYS_DSN = 4; // add a system DSN
15 public static final short ODBC_CONFIG_SYS_DSN = 5; // Configure a system DSN
16 public static final short ODBC_REMOVE_SYS_DSN = 6; // remove a system DSN
17 public static final short ODBC_REMOVE_DEFAULT_DSN = 7; // remove the default DSN
18
19 /***
20 * Calls the SQLConfigDataSource in win32 systems
21 * @param type Type of call
22 * @param driver Driver name
23 * @param attributes Attributes string
24 */
25 public static native boolean SQLConfigDataSource( short type, String driver, String attributes);
26
27 public static void main( String[] args) throws NumberFormatException {
28 if( args.length != 1)
29 System.out.println( "Use:\nODBCUtil dsn_name file_name");
30 else {
31 System.out.println(args[0]);
32 System.out.println( SQLConfigDataSource( ODBC_ADD_DSN,
33 "Microsoft Access Driver (*.mdb)",
34 args[0]));
35 }
36 }
37 }
This page was automatically generated by Maven