Focal Point
JDBC Code

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/1381057331/m/8071060342

August 21, 2007, 04:01 PM
dertown
JDBC Code
I am trying to access EDA server throught the Jlink /JDBC library. I keep getting empty record sets. is there any exmples on how to do this?
August 28, 2007, 11:22 AM
dhagen
Simple example:

Make sure jlink.jar is on the classpath.

package ibiexample;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class IBIJdbcCall {
	
	public static void main(String args[]) { 
		Connection conn = null;
		PreparedStatement ps = null;
		ResultSet rs = null;
		
		try {
			Class.forName("ibi.jlink.EdaDriver");
			conn = DriverManager.getConnection("jdbc:eda://localhost:8116;server=EDASERVE", "userid", "password");
			ps = conn.prepareStatement("SELECT * FROM CAR WHERE COUNTRY = ?");
			ps.setString(1, args[0]);
			rs = ps.executeQuery();
			
			// If there are rows
			if (rs != null) {
				while ( rs.next() ) {
					for ( int i = 1 ; i <= rs.getMetaData().getColumnCount(); i++ ) {
						System.out.print(rs.getObject(i).toString() + "\t");
					}
					System.out.println(" ");
				}
			}
		} catch (SQLException eSQL) {
			System.out.println("General SQL Exception: " + eSQL);
		} catch (Exception e) {
			System.out.println("General Exception: " + e);
		} finally {
			try {
				ps.close();
				rs.close();
				conn.close();
			} catch (SQLException eSQL) {
				System.out.println("General SQL Exception While closing connections: " + eSQL);
			}
		}
	}
	
}



"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
May 20, 2010, 07:24 AM
swell.wang
where could i download the jlink.jar?
could you send it to me please?
thanks a lot.


webfocus 7.65
windows xp sp3
excel,html ,pdf,and graph