This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
tutorials:simple_flatfile_java_jdbc [2009/12/05 18:57] tdo |
tutorials:simple_flatfile_java_jdbc [2012/10/26 14:46] (current) |
||
|---|---|---|---|
| Line 2: | Line 2: | ||
| <html><div align="center"><span style="color:red">DRAFT</span></div></html> | <html><div align="center"><span style="color:red">DRAFT</span></div></html> | ||
| ====== Simple Java program using JDBC to access an Omnidex Environment ====== | ====== Simple Java program using JDBC to access an Omnidex Environment ====== | ||
| - | ===== Step 1 - Create the JAVA program ===== | + | ===== Step 1 - Create the JAVA program to test JDBC Connect ===== |
| <code JAVA> | <code JAVA> | ||
| Line 52: | Line 52: | ||
| } //end class | } //end class | ||
| </code> | </code> | ||
| - | |||
| ===== Step 2 Run OdxNet ===== | ===== Step 2 Run OdxNet ===== | ||
| - | ==== Step 2 Create an Omnidex Datasource File ==== | ||
| - | ===== Step 4 Compile the JAVA application ===== | ||
| - | ===== Step 5 Run and test the JAVA applications ===== | ||
| + | * Under Windows, open a console window | ||
| + | * Run OdxNet | ||
| + | * OdxNet will default to listening on PORT 7555. | ||
| + | ===== Step 3 Create an Omnidex Datasource File ===== | ||
| + | ===== Step 4 Compile the JAVA application ===== | ||
| + | Before compiling the java source program, make sure the following: | ||
| + | * A path exists to the Omnidex.jar file containing the Omnidex JDBC driver. | ||
| - | ===== Step 4 ===== | + | C:\dev\java>javac OdxTestConnection.java |
| - | + | ===== Step 5 Run and test the JAVA applications ===== | |
| - | + | ===== Step 6 Add Test SQL SELECT Statement ===== | |
| - | ===== Step 2 - Add Test SQL SELECT Statement ===== | + | |
| <code java> | <code java> | ||
| /** Omnidex JDBC Example: Simple Select | /** Omnidex JDBC Example: Simple Select | ||
| Line 104: | Line 106: | ||
| // The SQL statement to be executed | // The SQL statement to be executed | ||
| - | String sql = "select * from table1"; | + | String sql = "select * from table1 where mytext = 'bears'"; |
| try | try | ||
| { | { | ||
| Line 141: | Line 143: | ||
| </code> | </code> | ||
| + | ===== Compile and test the SELECT Statement ===== | ||
| + | |||
| + | {{:cmd:cmd_java_jdbc_simple.png|}} | ||
| {{page>:bottom_add&nofooter&noeditbtn}} | {{page>:bottom_add&nofooter&noeditbtn}} | ||