August 21, 2007, 04:01 PM
dertownJDBC 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
dhagenSimple 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);
}
}
}
}
May 20, 2010, 07:24 AM
swell.wangwhere could i download the jlink.jar?
could you send it to me please?
thanks a lot.