Jump to content
Server Maintenance This Week. ×

Working with JDBC


xtrim

This topic is 6336 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi,

Does anyone have a WORKING JDBC example (Java code) that connects with Filemaker??

I've been trying for a week ( :frown: ) now with the examples Filemaker Server 8.5 has on the disc...

Can't get it to work...

Please help...

Link to comment
Share on other sites

How about this?


1. Create a database (Untitled.fp7).

2. Create a field.

3. Go to browse mode and create a few records with proper value.

4. Publish the file using ODBC/JDBC protocol.

5. Create a java source (JdbcTest.java).

6. Compile (javac JdbcTest.java).

7. Execute (java -cp .:sljc.jar JdbcTest).



-- Contents of JdbcTest.java

import java.sql.*;



public class JdbcTest

{

  public static void main(String[] args)

  {

    try

    {

      Class.forName("com.ddtek.jdbc.sequelink.SequeLinkDriver"); // Load driver.

      Connection con = DriverManager.getConnection( "jdbc:sequelink://127.0.0.1:2399;serverdatasource=Untitled", "admin", "" );    // Get connection.

      final String sql = "select * from Untitled";

      Statement stmt = con.createStatement();

      ResultSet rs = stmt.executeQuery(sql);

      while (rs.next())

      {

        System.out.println("value = " + rs.getString(1));

      }

      con.close();      // Closing connection.

    }

    catch ( Exception e ) { e.printStackTrace(); }

  }

}



Hope this helps.

Link to comment
Share on other sites

This topic is 6336 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.