DRAFT

/** Java Program to test a connection to the Omnidex
 *  JDBC driver.
 *	Make sure OdxNet is running
 *	Create a JDBC Datasource file with DSEDIT.
 *	Make sure there is a path setting to the Omnidex bin directory.
*/
 
import java.io.*;
import java.sql.*;
public class OdxTestConnection 
{
  static public void main(String args[]) 
  {
    Connection odxconnection = null;
	try 
	{ 
	   Class.forName("omnidex.jdbc.OdxJDBCDriver");
	}
	catch ( ClassNotFoundException ce ) 
	{ 
	  ce.printStackTrace();
	  return;
	}
	try 
	{
	   odxconnection = DriverManager.getConnection
	     ("jdbc:omnidex:c:\\dev\\odx\\tiny\\tiny.dsn");
	  System.out.println("Omnidex JDBC Connection successful!");
	  // Do SELECTS here
	}
	catch (SQLException e) 
	{
      e.printStackTrace();
    }
    finally 
	{
      if (odxconnection != null ) 
	  {
          try { odxconnection.close(); }
		  catch( SQLException e ) 
		  {
		    e.printStackTrace();
	      }
	  }
	}
  } // end main	 
} //end class
 
Back to top
dev/jdbc/examples/odxtestconnection.txt ยท Last modified: 2016/06/28 22:38 (external edit)