title: JDBC Java File Running Through Command Prompt
body: <p>I have created a java gui within Netbeans and am now attempting to run it through Command Prompt using the <code>java -jar [filename].jar</code> command.</p>
  
  <p>The gui I have created connects to a database (also created within the Servers section of Netbeans). The database is connected to view the <code>jdbc:derby://localhost:1527/[DBName]</code> command. It also takes in the user name and password and then connects.</p>
  
  <p>My issue is, I can connect within Netbeans (obviously I have to find the database in the Services tab first and connect to it) but I can't connect to the database in command prompt.</p>
  
  <p>With the completed code I have selected 'Clean and Build' in Netbeans to create the .jar file in the /dist folder.</p>
  
  <p>I can run the .jar file but it returns an error stating: <code>java.net.ConnectionException : Error connecting to server localhost on port 1527 with message Connection refused: connect.</code></p>
  
  <p>My /dist folder contains the .jar file for the application as well as a README.TXT file and a /lib folder, which itself contains the derbyclient.jar file.</p>
  
  <p>When creating my database I set the location as the java project directory so within the java project directory I have a /[DBName] folder that I assume contains my database.</p>
  
  <p>How do I connect to the database in command prompt? Or at least allow my program to do so?</p>
  
  <p>Do I have to explicitly declare the location of my database?</p>
  
  <p>Do I need to export the database from Netbeans somehow?</p>
  
  <p>Any help would be great. I'm toying with Java at the moment and wanted to know how to run it in command prompt, completely standalone from any IDE's.</p>
  
  <p>J</p>