This is an old revision of the document!


DRAFT

Simple Java program using JDBC to access an Omnidex Environment

</code JAVA> 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 </code>

 
Back to top
tutorials/simple_flatfile_java_jdbc.1260038984.txt.gz ยท Last modified: 2012/10/26 14:42 (external edit)