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: Import Data from JDBC Data Sources Problem


Dear Peter!
I'm trying to import data from a Informix SQL Server table into InstantDB (3.20 beta 2) using the IMPORT-Statement shown on the InstantDB import.htm web site.
Running the IMPORT-Statement brings up the error message under (A).
If i try to set the deafult username and password, the error message under (B) comes up.
What's going wrong?
Thanks for help in advance! (juergen-roeder@t-online.de)
Juergen Roeder
 
===========================================================================================================================
(A)
===========================================================================================================================
Import.main() sql_drop_table = DROP TABLE stt
Import.main() sql_import_from_file = IMPORT stt FROM 'stt.txt' USING 'stt_schema.txt' BUFFER 2048
Import.main() sql_import_from_jdbc = IMPORT stt FROM URL 'jdbc:informix-sqli://192.168.168.3:1528/jdata:INFORMIXSERVER=dbs730_rm300' USING 'SELECT * FROM stt' BUFFER 2048
Import.main() sql_select = SELECT * FROM stt
Import.main() idbURL = jdbc:idb:d:\de\plus\base\properties\stt.prp
Enhydra InstantDB - Version 3.20 beta 2
The Initial Developer of the Original Code is Lutris Technologies Inc.
Portions created by Lutris are Copyright (C) 1997-2000 Lutris Technologies, Inc.
All Rights Reserved.
main DROP TABLE stt
Import.main() sql_drop_table       rc = -1
main IMPORT stt FROM URL 'jdbc:informix-sqli://192.168.168.3:1528/jdata:INFORMIXSERVER=dbs730_rm300' USING 'SELECT * FROM stt' BUFFER 2048
main java.sql.SQLException: Incorrect password or user com.informix.asf.IfxASFRemoteException:  is not known on the database server.
java.sql.SQLException: Incorrect password or user com.informix.asf.IfxASFRemoteException:  is not known on the database server.
 at org.enhydra.instantdb.db.SQLProg.execute(SQLProg.java:276)
 at org.enhydra.instantdb.jdbc.idbStatement.execute(idbStatement.java, Compiled Code)
 at org.enhydra.instantdb.jdbc.idbStatement.executeUpdate(idbStatement.java:103)Database stt is shutting down...
Database stt shutdown complete.
 at Import.main(Import.java:134)
==============================================================================================================
(B)
============================================================================================================================
Import.main() sql_drop_table       = DROP TABLE stt
Import.main() sql_import_from_file = IMPORT stt FROM 'stt.txt' USING 'stt_schema.txt' BUFFER 2048
Import.main() sql_import_from_jdbc = IMPORT stt FROM URL 'jdbc:informix-sqli://192.168.168.3:1528/jdata:INFORMIXSERVER=dbs730_rm300' USING 'SELECT * FROM stt' BUFFER 2048
Import.main() sql_select           = SELECT * FROM stt
Import.main() idbURL               = jdbc:idb:d:\de\plus\base\properties\stt.prp
Enhydra InstantDB - Version 3.20 beta 2
The Initial Developer of the Original Code is Lutris Technologies Inc.
Portions created by Lutris are Copyright (C) 1997-2000 Lutris Technologies, Inc.
All Rights Reserved.
main SET DEFAULT_USERNAME ******
Import.main() sql_set_default_username rc = -1
main SET DEFAULT_PASSWORD *******
main SET DEFAULT_PASSWORD *******
 Don't understand SQL after: "SET"
 Expected: "DATE" found: "DEFAULT_PASSWORD"
java.sql.SQLException: SET DEFAULT_PASSWORD *******
 Don't understand SQL after: "SET"
 Expected: "DATE" found: "DEFAULT_PASSWORD"
 at org.enhydra.instantdb.db.SQLProg.execute(SQLProg.java:215)
 at org.enhydra.instantdb.jdbc.idbStatement.execute(idbStatement.java, Compiled Code)
 at org.enhydra.instantdb.jdbc.idbStatement.executeUpdate(idbStatement.java:103)Database stt is shutting down...
Database stt shutdown complete.
 at Import.main(Import.java:126)
 
 
 
/**
 * Import data from JDBC data source (Informxix SQL Server)
 * <p>
 * @author Jürgen Röder
 * @since  1.00 (2000-09-07 24:00:00)
 */
import java.io.*;
import java.sql.*;
import org.enhydra.instantdb.jdbc.*;
import org.enhydra.instantdb.db.*;

public class Import {

    private static final String IDB_DRIVER = new String("org.enhydra.instantdb.jdbc.idbDriver");
    private static final String INFORMIX_DRIVER = new String("com.informix.jdbc.IfxDriver");
    private static final String FS = new String(System.getProperty("file.separator"));
    private static final String PRP = new String(".prp");
    private static final String TXT = new String(".txt");
    private static final String SCHEMA = new String("_schema.txt");
    private static StringBuffer PROPERTY_DIRECTORY = new StringBuffer("d:").append(FS).append("de").append(FS).append("plus").append(FS).append("base").append(FS).append("properties").append(FS);

/**
 * Import data from JDBC data source (Informxix SQL Server)
 * <p>
 * @author Jürgen Röder
 * @since  1.0.0  (2000-09-07 24:00:00)
 * @param  String [] Parameter
 * @return void
 */
public static void main (String args[]) {

    String idbURL = new String("jdbc:idb:");
    String informixURL = new String("jdbc:informix-sqli://192.168.168.3:1528/jdata:INFORMIXSERVER=dbs730_rm300");
    String uid = new String("********");
    String pword = new String("******");

    Connection con = null;
    Statement stmt = null;
    CallableStatement cstmt = null;
    PreparedStatement pstmt = null;

    int rc = 0;

    if (args.length != 0) {
        String prpFile = new String(args[0] + PRP);
        String txtFile = new String(args[0] + TXT);
        String schemaFile = new String(args[0] + SCHEMA);

        //String sql_drop_table = new String("DROP TABLE " + args[0]);
        String sql_drop_table = new String("DROP TABLE stt");
        String sql_import_from_file = new String("IMPORT " + args[0] + " FROM '" + txtFile + "' USING '" + schemaFile + "' BUFFER 2048");
        String sql_import_from_jdbc = new String("IMPORT stt FROM URL '" + informixURL + "' USING 'SELECT * FROM stt' BUFFER 2048");
        //String sql_import_from_jdbc = new String("IMPORT " + args[0] + " FROM URL '" + informixURL + "' USING 'SELECT * FROM " + args[0]  + "' BUFFER 2048");
        //String sql_select = new String("SELECT * FROM " + args[0]);
        String sql_select = new String("SELECT * FROM stt");

        System.out.println("Import.main() sql_drop_table       = " + sql_drop_table);
        System.out.println("Import.main() sql_import_from_file = " + sql_import_from_file);
        System.out.println("Import.main() sql_import_from_jdbc = " + sql_import_from_jdbc);
        System.out.println("Import.main() sql_select           = " + sql_select);

        prpFile = PROPERTY_DIRECTORY + prpFile;
        schemaFile = PROPERTY_DIRECTORY + schemaFile;
	/*
	 * 1. Load driver(s)
	 */
        try {
	    Class.forName(IDB_DRIVER);
        } catch (Exception e) {
            System.out.println("Failed to load InstantDB JDBC Driver. " + e.getMessage());
        };

        try {
	    Class.forName(INFORMIX_DRIVER);
        } catch (Exception e) {
            System.out.println("Failed to load Informix JDBC Driver.  " + e.getMessage());
        };

	/*
	 * 2. Connect to database
	 */
	idbURL = idbURL + prpFile;
        System.out.println("Import.main() idbURL               = " + idbURL);

        try {
    	    //con = DriverManager.getConnection(idbURL, uid, pword);
       	    con = DriverManager.getConnection(idbURL);
        } catch (Exception e) {
            System.out.println("Import.main() Connection to database failed. " + e.getMessage());
        };

        /*
        try {
       	    con = DriverManager.getConnection(informixURL, "******", "*******");
        } catch (Exception e) {
            System.out.println("Import.main() Connection to database failed. " + e.getMessage());
        };
        */

        /*
        java.util.Enumeration enum = DriverManager.getDrivers();
        while(true) {
            if (enum.hasMoreElements()) {
                System.out.println(enum.nextElement());
            } else break;
        };
        */

	/*
	 * 3. Create statement
	 */
        try {
	    stmt = con.createStatement();
        } catch (Exception e) {
            System.out.println("Import.main() Create statement failed. " + e.getMessage());
        };

        /*
	 * 4. Create table using executeUpdate()
	 */
        try {


	    rc = stmt.executeUpdate("SET DEFAULT_USERNAME roeder");
	    System.out.println("Import.main() sql_set_default_username rc = " + rc);
	    rc = stmt.executeUpdate("SET DEFAULT_PASSWORD jr22056");
	    System.out.println("Import.main() sql_set_default_password rc = " + rc);


	    rc = stmt.executeUpdate(sql_drop_table);
	    System.out.println("Import.main() sql_drop_table       rc = " + rc);
	    //rc = stmt.executeUpdate(sql_import_from_file);
	    //System.out.println("Import.main() sql_import_from_file rc = " + rc);
	    rc = stmt.executeUpdate(sql_import_from_jdbc);
	    System.out.println("Import.main() sql_import_from_jdbc rc = " + rc);
        } catch (SQLException ex) {
            ex.printStackTrace ();
        };

        /*
	 * 5. Close connection
	 */
        try {
            stmt.close();
            con.close();
        } catch (SQLException ex) {
            ex.printStackTrace ();
        };


    } else {
        System.out.println("Import.main() No arguments specified...");
    };

}

}