Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help running getting project to function outside of Netbeans

Status
Not open for further replies.

chunkII123

IS-IT--Management
Mar 18, 2009
78
US
Hey yall,

Well, heres a good one for you, this will probably be simple and someone should kick me, whatever. At my company we have two offices, one is in Grand Rapids, one is in Flint (Michigan); anyhow, both locations now have servers, GR had the server first, and it runs MySQL 5.0-community-nt, this runs the backbone of our software. I recently got a server for our flint office and I am making a "shadow" copy of the server here, however I am using their DB (microsoft access migrated to SQL 5.0-community-nt). I made all necessary tables and views that the software calls to, and did a backup/restore from GR to Flint of the users and other settings. Now you're asking me what the problem is right, well here goes, when I compile and run the software in Netbeans it runs just fine, however when I build the program and run it outside of netbeans it sticks at "connecting to server" heres the dilly

<code>
public Connection getConnection() {
try {
if (dbConnection == null || dbConnection.isClosed()) {
//Register the JDBC driver for MySQL.
Class.forName("com.mysql.jdbc.Driver");

url = "jdbc:mysql://server/membersinfo";

userName = "GRuser01";
password = "user01";

Connection con = DriverManager.getConnection(url, userName, password);
//statusTextArea.setText("Connection: " + con);

System.out.println("URL: " + url + "\nConnection: " + con);

dbConnection = con;
return con;
} else return dbConnection;
}catch( Exception exc ) {
exc.printStackTrace();
WarningMessage warning = new WarningMessage(true, "Error: " + CLASS_NAME + " " + exc.getMessage(), WarningMessage.CRITICAL_ERROR);
warning.setVisible(true);
return null;
}//end catch
}
</code>

That is the DB connection we're using in java. When one opens the program it opens our "switchboard" form and does a Db connection query...

<code>
initComponents();
dbConnection = new DataAccessObject();

// Local method!
addActionListeners();

java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
setSize((int)screenSize.getWidth(), 79);
}
</code>

I triple checked the MySQL username and password info, and that is correct. so there must be something in the programming that is a wee bit off. Or i'm a moron and posted in the wrong forum and really needed to go to the MySQL forum, and if thats the case, I am EXTREMELY sorry to the mod who has to move it, if this is however in the right place, Thank you ahead of time for any help that you all can shine on the subject. Also, this code works flawlessly at our Grand Rapids office, but not at our Flint one. Thanks again.
 
Most likely the jdbc-driver jars are not available through the classpath, and the errormessage (printstacktrace) either is hidden by other windows, or is printed to a non-existing output.

HTH
TonHu
 
I don't see where the "connecting to the server" message is, but I still can guess there's a problem with the classpath.

Did you include the driver in the classpath? How are you running the program?

Cheers,
Dian
 
Yup, you can call me retarted,. it was serching for a non existant classpath because it was a direct copy from the other machine. I re-indexed the classpath, and guess what...it worked perfectly, to bad I can't get those 8 hours of my life back. iMoron.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top