Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    Apr 2004
    Messaggi
    6

    sqlexception in cloudscape

    Ciao!

    Ecco il mio problema:

    FILE JAVA
    /**
    * @version 1.20 1999-08-16
    * @author Cay Horstmann
    */

    import java.net.*;
    import java.sql.*;
    import java.io.*;
    import java.util.*;

    class MakeDB
    { public static void main (String args[])
    { try
    { Connection con = getConnection();
    Statement stmt = con.createStatement();

    String tableName = "";
    if (args.length > 0)
    tableName = args[0];
    else
    { System.out.println("Usage: MakeDB TableName");
    System.exit(0);
    }

    BufferedReader in = new BufferedReader(new
    FileReader(tableName + ".dat"));

    createTable(tableName, in, stmt);
    showTable(tableName, stmt);

    in.close();
    stmt.close();
    con.close();
    }
    catch (SQLException ex)
    { System.out.println ("SQLException:");
    while (ex != null)
    { System.out.println ("SQLState: "
    + ex.getSQLState());
    System.out.println ("Message: "
    + ex.getMessage());
    System.out.println ("Vendor: "
    + ex.getErrorCode());
    ex = ex.getNextException();
    System.out.println ("");
    }
    }
    catch (IOException ex)
    { System.out.println("Exception: " + ex);
    ex.printStackTrace ();
    }
    }

    public static Connection getConnection()
    throws SQLException, IOException
    { Properties props = new Properties();
    String fileName = "MakeDB.properties";
    FileInputStream in = new FileInputStream(fileName);
    props.load(in);

    String drivers = props.getProperty("jdbc.drivers");
    if (drivers != null)
    System.setProperty("jdbc.drivers", drivers);
    String url = props.getProperty("jdbc.url");
    String username = props.getProperty("jdbc.username");
    String password = props.getProperty("jdbc.password");

    return
    DriverManager.getConnection(url, username, password);
    }

    public static void createTable(String tableName,
    BufferedReader in, Statement stmt)
    throws SQLException, IOException
    { String line = in.readLine();


    /* String command2 = "DROP TABLE " + tableName;
    System.out.println(command2);
    stmt.executeUpdate(command2);*/



    String command = "CREATE TABLE " + tableName
    + "(" + line + ")";
    System.out.println(command);
    stmt.executeUpdate(command);

    while ((line = in.readLine()) != null)
    { command = "INSERT INTO " + tableName
    + " VALUES (" + line + ")";
    System.out.println(command);
    stmt.executeUpdate(command);
    }
    }

    public static void showTable(String tableName,
    Statement stmt) throws SQLException
    { String query = "SELECT * FROM " + tableName;
    ResultSet rs = stmt.executeQuery(query);
    ResultSetMetaData rsmd = rs.getMetaData();
    int columnCount = rsmd.getColumnCount();
    while (rs.next())
    { for (int i = 1; i <= columnCount; i++)
    { if (i > 1) System.out.print(", ");
    System.out.print(rs.getString(i));
    }
    System.out.println();
    }
    rs.close();
    }
    }


    FILE PROPRIETIES

    jdbc.drivers=sun.jdbc.odbc.JdbcOdbcDriver
    jdbc.url=jdbcdbc:esameDB;create=true
    jdbc.username=""
    jdbc.password=""

    --------------------------------------------

    ottengo il seguente errore:
    SQLException:
    SQLState:08001
    Message: no suitable driver
    Vendor: 0

    qualcuno sa dirmi come risolvere il problema?
    P.S.: sul pc ho installato la j2ee1.3.1 e la j2se1.4.2

  2. #2
    Utente di HTML.it
    Registrato dal
    Apr 2004
    Messaggi
    6

    errata corrige

    il file proprieties richiamato è:

    jdbc.drivers=COM.cloudscape.core.RmiJdbcDriver
    jdbc.url=jdbc:cloudscape:rmi:esameDB;create=true
    jdbc.username=""
    jdbc.password=""

    SCUSATE!

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.