aspose file tools*
The moose likes JDBC and the fly likes JDBC-ODBC java.sql.SQLException: General error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC-ODBC java.sql.SQLException: General error" Watch "JDBC-ODBC java.sql.SQLException: General error" New topic
Author

JDBC-ODBC java.sql.SQLException: General error

Abiodun Lawal
Greenhorn

Joined: Dec 29, 2010
Posts: 2
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

Joined: Jun 01, 2010
Posts: 618
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

Joined: Dec 29, 2010
Posts: 2
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC-ODBC java.sql.SQLException: General error