File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases 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 and Relational Databases
Bookmark "JDBC-ODBC java.sql.SQLException: General error" Watch "JDBC-ODBC java.sql.SQLException: General error" New topic

JDBC-ODBC java.sql.SQLException: General error

Abiodun Lawal

Joined: Dec 29, 2010
Posts: 2

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(
at com.mantraa360.sql.SQLOperations.getAllServices(
at com.mantraa360.schedule.CronTaskSchedule.main(
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 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 = "";
return DriverManager.getConnection(url, username, password);

Tom Reilly

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

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:
subject: JDBC-ODBC java.sql.SQLException: General error
It's not a secret anymore!