Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Howiieque

macrumors regular
Original poster
Feb 1, 2009
120
0
Hi.
I want to use FileMaker database as the data source locally. Must I have the server edition?
I have installed JDBC Client Driver, but java can found it.
Where should I install it?
Or my code has some problems?
here is the code:
Code:
import java.sql.*;
public class testDrive {
	public static void main(String args[]) {
		
		// register the JDBC client driver
		try {
			Driver d=(Driver)Class.forName("com.ddtek.jdbc.sequelink.SequeLinkDriver").newInstance();
			//Class.forName("com.ddtek.jdbc.sequelink.SequeLinkDriver");
		} catch(Exception e) {
			System.out.println(e);
		}
		
		// establish a connection to FileMaker
		Connection con;
		try {
			con=DriverManager.getConnection("jdbc:sequelink://localhost:2399;serverDataSource=Records");
		} catch(Exception e) {
			System.out.println(e);
		}
		
		// get connection warnings + ";serverDataSource=" + dbName
		/*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);
		}*/
	}
}

Further more, are there any special settings needed in FileMaker?
Please give a comment. Thank you in advanced.

screen shot:
 

Attachments

  • Picture 1.png
    Picture 1.png
    6.7 KB · Views: 134
Installing the driver doesn't mean anything. You need to add the location of the JDBC driver to your classpath system variable. That is what Java is telling you.
 
Thank you so much for your reply.
After using the tool ship with that drive, I recognised that the class path wasn't set properly. But the problem is that I don't know how to set it.
I followed the instruction to install the driver into /Library/Java/Extensions.
Deep in it, lives a driver folder which including lib folder containing sljc.jar. that's it. I am sure that com.ddtek.jdbc.sequelink.SequeLinkDriver is inside it.
I am a newbie to Java. Please give a detail explanation. I have been trying to do my homework--making query to database driven by servlet & jsp. I am longing to see your answer again.
 
Your classpath is set in your login file.

CLASSPATH=/Library/Java/Extensions/sljc.jar
export CLASSPATH

java yourprogramname

You can put the CLASSPATH definition in either your .bashrc file or your .profile file.
 
Thank you for your generous reply.
I am absolutely don't know unix.
CLASSPATH=/Library/Java/Extensions/sljc.jar
export CLASSPATH

java yourprogramname
I typed it in the terminal and it couldn't find my programme this time.
.bashrc and .profile How can I find them.

Please explain one more time.
 
Thank you for your generous reply.
I am absolutely don't know unix.

I typed it in the terminal and it couldn't find my programme this time.
.bashrc and .profile How can I find them.

Please explain one more time.

Open the Terminal application and type the following command:

nano .profile

this opens up a command line text editor. Add the correct text and save it by pressing Ctrl + O and then quit by pressing Ctrl + X. This will save it. You may need to log out at this point for the change to take effect.
 
Thank you. Thank you very much.
It has haunted me for a long time and spent me more than a day to solve it.
May God bless you.

here is what I put into .profile:
Code:
SLJC_DRIVER=/Library/Java/Extensions/driver/lib/sljc.jar
export SLJC_DRIVER
CLASSPATH=$SLJC_DRIVER:$CLASSPATH
export CLASSPATH

Am I right?
I am adding both the original one and the driver path to CLASSPATH.
If I just wrote
CLASSPATH=/Library/Java/Extensions/driver/lib/sljc.jar
export CLASSPATH
then the JVM would fail to find my programm, for it just looked into that path.
Am I right?

here is my test code:
Code:
import java.sql.*;
public class test {
	public static void main(String[] args) {
		
		// register the JDBC client driver
		try {
			//Driver d=(Driver)Class.forName("com.ddtek.jdbc.sequelink.SequeLinkDriver").newInstance();
			Class.forName("com.ddtek.jdbc.sequelink.SequeLinkDriver");
		} catch(Exception e) {
			System.out.println(e);
		}
		
		// establish a connection to FileMaker
		Connection con;
		try {
			con=DriverManager.getConnection("jdbc:sequelink://localhost:2399; user=Admin; password=Admin; serverDataSource=Records");
			PreparedStatement statement=con.prepareStatement("SELECT Last_Name FROM Records");
			ResultSet result=statement.executeQuery();
			while (result.next()) {
				String name=result.getString("Last_Name");
				System.out.println(name);
			}
			result.close();
			statement.close();
			con.close();
		} catch(Exception e) {
			System.out.println(e);
		}
		
		// get connection warnings + ";serverDataSource=" + dbName
		/*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);
		}*/
	}
}
Hope that will help anyone encounters this kind of questions.:D;):p
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.