Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC-ODBC java.sql.SQLException: General error

 
Abiodun Lawal
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to connect to a DSN for MsAccess, but I am getting this error on connection when I run it as a Stand alone, but when I test the same application within NetBeans it works fine can anyone please help trace where the issue might be.
Note : I created the DSN as a System DSN in order to allow all users access it.

SEVERE: null
java.sql.SQLException: General error
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.mantraa360.sql.SQLOperations.getConnection(SQLOperations.java:1036)
at com.mantraa360.sql.SQLOperations.getAllServices(SQLOperations.java:559)
at com.mantraa360.schedule.CronTaskSchedule.run(CronTaskSchedule.java:68)
at com.mantraa360.schedule.CronTaskSchedule.main(CronTaskSchedule.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:136)
at java.lang.Thread.run(Unknown Source)

See Code Segment below :

private static Connection getConnection() throws Exception {
String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
String url = "jdbcdbc:SMSAlert";
String username = "";
String password = "";
Class.forName(driver);
return DriverManager.getConnection(url, username, password);
}

 
Tom Reilly
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because it works in NetBeans, I would suspect a classpath problem. That is, the application is not seeing all the jar files it needs to run. Can you provide details on how you started the stand alone application?
 
Abiodun Lawal
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tom,

Thanks for the reply, I have actually gotten it to work, the solution was however funny, I had to delete the DataSource and recreated it using the same same name, and made sure I created it as System DSN alone, removing the User DSN, restarted the Application and it worked.

Thanks for the response.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic