Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

getting started with JDBC--java error on simple program

Featured Replies

Hi, question about my first foray into JDBC:

Background: FM Pro Advanced 11, intermediate user, not a Java programmer, Mac OS 10.7, latest Java update installed, downloaded FM JDBC driver (fmjdbc.jar) from FM website, copied to /Library/Java/Extensions as instructed.

Tried to copy and compile the short Java program in the FM ODBC/JDBC manual to confirm connectivity, (BTW, why would that manual have a sample program with the message "Note This example is not meant to be compiled."--not nice!), and got an error.

Source code:

import java.sql.*;

class FMPJDBCTest

{

public static void main(String[ ] args)

{

// register the JDBC client driver

try {

Driver d = (Driver)Class.forName("com.filemaker.jdbc.Driver").newInstance();

} catch(Exception e) {

System.out.println(e);

}

// establish a connection to FileMaker

Connection con;

try {

con = DriverManager.getConnection("jdbc:filemaker://127.0.0.1/locations Converted","admin", "admin");

} catch(Exception e) {

System.out.println(e);

}

// get connection warnings

SQLWarning warning = null;

try {

warning = con.getWarnings();

if (warning == null) {

System.out.println("No warnings");

return;

}

while (warning != null) {

System.out.println("Warning: "+warning);

warning = warning.getNextWarning();

}

} catch (Exception e) {

System.out.println(e);

}

} }

Compile error:

javac ~/Desktop/FMPJDBCTest.java

/Users/wdockery/Desktop/FMPJDBCTest.java:22: variable con might not have been initialized

warning = con.getWarnings();

^

Advice on how to proceed? Thanks--

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.