Grazie mille per la risposta.
Utilizzando la guida qui su HTML.it ho capito un po' questo concetto del "classpath", per� ancora non arrivo a soluzione.
Questo è il codice nel mio file Test.java
nella cartella del file Test.java ho anche il file mssql.jar. Utilizzo il comando:codice:import java.sql.*; import com.microsoft.sqlserver.jdbc.*; import java.util.logging.Level; import java.util.logging.Logger; public class Test { /** * @param args the command line arguments */ public static void main(String[] args) { CallableStatement cstmt = null; ResultSet rs = null; String Connectionurl="jdbc:sqlserver://IP\\SQLINSTANCE;DatabaseName=DBNAME;user=USERNAME;Password=PSW"; Connection con = null; Statement stmt = null; try { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDataSource"); cstmt = DriverManager.getConnection(Connectionurl).prepareCall("{call INS_TEST(?)}", ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY); // cstmt = con.getConnection().prepareCall("{call INS_TEST(?)}", ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY); cstmt.setInt("num", 4); boolean results = cstmt.execute(); int rowsAffected = 0; } catch (Exception ex) { Logger.getLogger(Test.class.getName()).log( Level.SEVERE, null, ex); } finally { if (rs != null) { try { rs.close(); } catch (SQLException ex) { Logger.getLogger(Test.class.getName()).log( Level.WARNING, null, ex); } } if (cstmt != null) { try { cstmt.close(); } catch (SQLException ex) { Logger.getLogger(Test.class.getName()).log( Level.WARNING, null, ex); } } } } }
javac -cp mssql.jar Test.java e non ricevo nessun errore
dopo faccio
java Test e ricevo l'errore che non trova la classe all'interno del .jar
Cosa devo fare?
Grazie mille

Rispondi quotando
