This content has been marked as final. Show 23 replies
Presumably your applet tag references the jar containing the Driver implementation and you've successfully registered the driver?
Some clarification ... I'm using the JDBC-ODBC driver and, yes the driver is reqistered properly (again, it's running fine as a Java application).
I'm using the appletviewer to test the applet and that is where I'm getting the error. Are there any adidtional parameters that I should be adding to the <APPLET> tag?
Can you provide more information about where you're getting this exception and whether you're registering the driver using Class.forName()?
I'm getting the error message when I'm trying to connect to the database ... it's throwing an SQLException error, not a ClassNotFoundException.
I think that the error message is a bit misleading as it has no problem finding the driver. In any event, the driver is being registered using:
Presumably the stack trace indicates that the exception originates in DriverManager and not JdbcOdbcDriver?
1. You will have the class available to you when you compile your code. So try using
and see what exception you get then.
2. ODBC-DSN is a local property of your machiene which will NOT be available to your applet when it runs on your client machiene, so unless you have a very targeted client base and you are sure that you client will have the ODBC-DSN with the same name created on his system, you should not go throught the JDBC-ODBC bridge.
3. Talking to the database directly from the Applet is not a good practice, you might run into some security issues when you deploy your applet in a production enviorment.
Hope this helps
Actually, the stack trace is not originating at the driver at all. It's referring to the implementation of the actionPerformed method of the ActionListener class.
It definitely has to do with the fact that it's running as an applet instead of an application.
I would definitely agree with Omer - Applets and ODBC (and arguably JDBC) seem like odd companions and should be avoided: if you can set up an ODBC data source then you can probably install a full-blown Java application as well.
Your exception must be originating within JDBC somewhere - any chance of you posting the stack trace?
Thanks for the reply. See responses below ...
1. You will have the class available to you when youSame result as using Class.forName().
compile your code. So try using
and see what exception you get then.
2. ODBC-DSN is a local property of your machienePoints 2 & 3 well taken. Fortunately, we do have a very small user base and it's no problem having to register the DSN's on each machine.
which will NOT be available to your applet when it
runs on your client machiene, so unless you have a
very targeted client base and you are sure that you
client will have the ODBC-DSN with the same name
created on his system, you should not go throught the
3. Talking to the database directly from the Applet
is not a good practice, you might run into some
security issues when you deploy your applet in a
Our situation is that we're using a combination of platforms for this application. It's also limited to our Intranet so security isn't an issue.
Thanks for the reply!
Hope this helps
Cannot get a connection to the database. <-- my code
No suitable driver <-- SQLException.getMessage()
Exception occurred during event dispatching: <-- stackTrace
You're throwing the NullPointerException?
Multiple platforms certainly doesn't imply Applets! ODBC would seem like an even less likely choice in that case.
Just for the sake of interest (because it really doesn't focus on this problem) let me explain.
We use Lotus Domino for many of our applications. Great platform RAD for apps that require document flow and messaging features. These documents display nicely in a Notes client. If our only requirement was to show information pertaining to a contract, for example, we wouldn't need Java.
However, as you know, things are rarely that simple. The users would also like to see cash transactions for each contract when they are reviewing it. Domino does not lend itself to storing transactional information ...
Soooo ... by multiple platform, I mean that some info is stored in Domino docs and other info is stored on SQL Server. It was thought that Java may be a nice way to integrating the two by displaying the transactions in a JTable when displaying the contract in a browser. That's what we're trying to prototype.
Thanks for the input.
Basically your trying to refrence methods or variables of a variable that is set to null in your class; should be on line 76 of your source code in the file DbaApplet.java in the method actioinPerformed.
If you cant figure it out post the code and lets see what the problem is. :-)
The "null" variable is the variable used to store my Connection class. My code ordinarily would exit the applet if it couldn't establish a db connection, but just to show that the stack trace wasn't origination with the JDBC driver, I continued to let it run.
I think that it has everything to do with the data source configuration. I will experiment with that.
Thanks for the help!!