Results 1 to 1 of 1
- 05-16-2011, 01:52 PM #1
Member
- Join Date
- May 2011
- Posts
- 1
- Rep Power
- 0
Swing application framework and SQL-connection in initialize method
Hallo
I have a strange problem with java and SAF. I'm using Netbeans and SAF for month and until last week, everything worked fine. But suddently my sql connections doesn't work very well.
Here is my code:
This code has worked for month with no problems. I'm using this code in several programs. But suddently in all of my programs, the connection to the database cannot be established. The program get stucked in the Drivermanager at following line "Connection result = di.driver.connect(url, info);" After 30min I get the exception "connection refused"Java Code:public static void main(String[] args) { launch(OperatorSuite2App.class, args); } @Override protected void initialize(String[] args) { super.initialize(args); try { SAXBuilder builder = new SAXBuilder(); Document doc = builder.build(new File(CONFIG_FILE)); Element root = doc.getRootElement(); String server = root.getChildText(SERVER); String database = root.getChildText(DATABASE); Class.forName("net.sourceforge.jtds.jdbc.Driver"); _con = DriverManager.getConnection("jdbc:jtds:sqlserver://" + server + "/" + database, _user, _password); _server = server; } catch (Exception ex) { JOptionPane.showMessageDialog(null, ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); exit(); } }
The strange thing is, if i use localhost everthing works fine again. If I initialize a SQL-connection (with another Connection var) to any database in the main-method (and directly close it), the above connection in initialize also works fine again.
I tried to use Wireshark. No packages were send over the network. So I guess, there is no problem at the server or network. My program stucks in DriverManager and no package is sent. On the other side, this code worked for month in several programs with no problems, so I cannot see any error in the code. My programs are installed on several machines and connects to several databases. My strange problem occoured over night on all programs and all databases.
I hope anybody can help me.
Similar Threads
-
Help about Viewa framework for Swing application
By trankly in forum AWT / SwingReplies: 0Last Post: 11-22-2010, 08:42 AM -
Japura - Java Swing application framework
By cadu.andrade in forum AWT / SwingReplies: 1Last Post: 06-09-2010, 03:31 AM -
Better Swing Application Framework 1.9 Milestone 1
By etf in forum Java SoftwareReplies: 0Last Post: 10-19-2009, 04:39 PM -
Better Swing Application Framework
By etf in forum Java SoftwareReplies: 1Last Post: 09-07-2009, 02:25 PM -
Swing Application Framework
By jurka in forum AWT / SwingReplies: 0Last Post: 10-09-2008, 06:01 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks