June 15, 200619 yr Newbies I am trying to add the ability to export data from a 100% java database (HsqlDB) to a FileMaker 8 database in a java application. I am trying to find example java code which shows the jdbc connection specific to using jdbc with Filemaker. I'm having a hard time figuring out how to use the included jdbc driver and I'm hoping some example code would help. Anyone know how to do this? Thanks PD
June 28, 200619 yr 1. Create new text file with the codes below and name it 'InsertSample.java'. 2. Compile it. [ javac InsertSample.java ] 3. Copy FileMaker JDBC client driver ('sljc.jar') to the same directory. 4. Run it. [ java -cp .:sljc.jar InsertSample ] import java.sql.*; public class InsertSample { public static void main(String[] args) { try { // Load driver. Class.forName("com.ddtek.jdbc.sequelink.SequeLinkDriver"); // Get connection. Connection con = DriverManager.getConnection( "jdbc:sequelink://127.0.0.1:2399;serverdatasource=DATABASE_NAME", "admin", "" ); String sql = "INSERT INTO TABLE_NAME (FIELD_NAME) values ('VALUE')"; Statement stmt = con.createStatement(); int result = stmt.executeUpdate(sql); // Closing connection. con.close(); } catch ( Exception e ) { e.printStackTrace(); } } } -- Replace the IP address, DATABASE_NAME, TABLE_NAME and FIELD_NAME as you need. DATABASE_NAME is the name of the filemaker database file without extension. TABLE_NAME and FIELD_NAME should be surrounded with double quotes (some particular words cause parse error). Note that you have to configure the sharing settings of the database to allow some users to access via JDBC. Hope this helps.
Create an account or sign in to comment