0

The sqljdbc4.jar isn't loaded or recognized even after following the steps from: java.sql.SQLException: No suitable driver found for jdbc:derby:

With this command the application does not start outside netbeans. Starting it only with: java -jar FXProductWatcher.jar # does not load the driver .jar

PS C:\Documents and Settings\User1\Meus documentos\x\workspace\FXProductWatcher\dist> java -classpath 'C:\Documents and Settings\User1\Meus documentos\x\workspace\FXProductWatcher\dist\lib\sqljdbc4.jar;FXProductWatcher.jar' FXProductWatcher

Results in> Error not able to locate or load main class FXProductWatcher

I'm using netbeans the manifest file is being generated automatically. I tried placing Class-Path: lib/sqljdbc4.jar but with no positive result.

The manifest from netbeans has:

JavaFX-Application-Class: fxproductwatcher.FXProductWatcher
JavaFX-Class-Path: lib/sqljdbc4.jar
Created-By: JavaFX Packager
Main-Class: com/javafx/main/Main

My connection code

try {
        Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
    } catch (ClassNotFoundException ex) {
        Logger.getLogger(DbConnection.class.getName()).log(Level.SEVERE, null, ex);
    }

    String sDbUrl = "jdbc:sqlserver://remoteIP;databaseName=test";

    conn = DriverManager.getConnection(sDbUrl, username, password);
    return conn;

Thanks for any help or sugestion.

Community
  • 1
  • 1
Andy
  • 55
  • 1
  • 12

1 Answers1

-2

Brother the url which you are using is :: jdbc:sqlserver://remoteIP;databaseName=test the ":"after sqlserver is not valid.

try this: jdbc:sqlserver//remoteIP;databaseName=test

this may work. good luck.

Pratik Joshi
  • 248
  • 2
  • 6
  • 23