InstantDB Project
About InstantDB
Project Mail Lists
Short History
Reporting Bugs
Screen Shots
3rd Party Examples
FAQs

Software
Downloads
Documentation
CVS Repositories
Roadmap
License

About Enhydra.org
Who We Are
News, Articles & Events
Getting Involved
Contact Us

Community
Demos
Contributions
Resources
Case Studies
On The Edge! -NEW-
Commercial Vendors


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

InstantDB: connection problems


hello,

i'm trying to test the rmi_jdbc sample below but it does not connect to the
database and java will not compile the following syntax:

//String url = "jdbc:idb=sample.prp"; (changed to)
	String url = "jdbc:idb:F:/InstantDB/Examples/sample.prp";

by the way..
when i have to connect to a *.prp on a diffrent drive in commsql
what is the correct syntax ??
Enter the URL for the database:
jdbc:idb:F:/InstantDB/Examples/sample.prp  (does not work)

Thanks Frank



/**
 * RmiJdbc client/server JDBC Driver
 * (C) GIE Dyade (Groupe BULL / INRIA Research Center) 1997
 *
 * @version     1.0
 * @author      Pierre-Yves Gibello (Pierre-Yves.Gibello@inrialpes.fr)
 */

import java.sql.*;
import java.net.InetAddress;

/**
 * This is a sample program for RmiJdbc client/server jdbc Driver
 * RmiJdbc relies on Java RMI for jdbc objects distribution
 */
public class TestClient {

  public static void main(String args[]) {

    try {

      // Register RmiJdbc Driver in jdbc DriverManager
      // The call to newInstance() is necessary on some platforms
      // (with some java VM implementations)
      Class.forName("RmiJdbc.RJDriver").newInstance();

      // Test with InstantDB free java database engine
      // See http://www.instantdb.co.uk for info & download
      //String url = "jdbc:idb=sample.prp"; (geändert in)
	String url = "jdbc:idb:F:/InstantDB/Examples/sample.prp";


      // RMI host will point to local host
      // A port number may be specified as 1st argument to the program

      String portSpec = "";
      if(args.length > 0) {
        Integer.parseInt(args[0]); // Check port number is an integer
        portSpec = new String(":" + args[0]);
      }

      String rmiHost = new String(
       "//" + InetAddress.getLocalHost().getHostName() + portSpec);

      // RmiJdbc URL is of the form:
      // jdbc:rmi://<rmiHostName[:port]>/<jdbc-url>

      String jurl = "jdbc:rmi:" + rmiHost + "/" + url;
      System.out.println("TestClient:" + jurl);
      Connection c = DriverManager.getConnection(jurl);

      Statement st = c.createStatement();
      ResultSet rs = st.executeQuery("select * from import1");

      ResultSetMetaData md = rs.getMetaData();
      while(rs.next()) {
        System.out.print("\nTUPLE: | ");
        for(int i=1; i<= md.getColumnCount(); i++) {
          System.out.print(rs.getString(i) + " | ");
        }
      }

      rs.close();

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

-----------------------------------------------------------------------------
To unsubscribe from this mailing list, send email to majordomo@enhydra.org
with the text "unsubscribe instantdb" in the body of the email.
If you have other questions regarding this mailing list, send email to
the list admin at owner-instantdb@enhydra.org.