• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SQL Server connect works in IDE but not in exported JAR

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All!

When I test run my application in Eclipse, the connection to the SQL Server works just fine. However, once I export my .jar file to the server, I am not getting any data from the database, rather just blank panels.

My Connection Code for my Accessor class:
=======================================================
Class.forName("net.sourceforge.jtds.jdbc.Driver");
con=java.sql.DriverManager.getConnection"jdbc:jtds:sqlserver://emr_COGNOS:1433;databaseName=emrwty",[userName],[password]);

I am using:
IDE - Eclipse 3.1.1
Driver - most recent jTDS driver
JRE - 1.5

I have:
1. Verified that the jTDS jar file is in the Eclipse build path
2. Verifed that the System Path variable includes the path to the java library where the jTDS jar resides

What am I missing?

Thanks tons for your responses and help!

JD
 
Ranch Hand
Posts: 381
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What exceptions are you getting? I suspect that the other jar is not there. I don't know what voodoo Eclipse does but I suspect the driver is not in the classpath.
 
JD Thompson
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First and foremost thanks for responding!!


java.lang.Class.forName(Unknown Source)

is the first line when I print out the stack trace elements from the error message.

This is what leads me to believe that the driver is not being built into the exported jar file.

Should I look into doing a manual compiling of the jar file and forcing the classpath in there?

Take care!

JD
 
JD Thompson
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Maximilian!

I can't thank you enough for taking the time and having the inclination to help me out.

I don't know what light bulb went off but in thinking about forcing the classpath into the build, I created a separate class folder and imported the jTDS jar file into that, and viola!, the app now works as intended!!

You just being willing to take the time to think about it and send a response was enough positive encouragement to try a few more things (I have been at this since Friday!!).

I wish I could buy you a beer!

Take care and thanks again!!

JD
 
Pay attention! Tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic