This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JDBC and the fly likes Class.forName Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Class.forName" Watch "Class.forName" New topic
Author

Class.forName

Philip Pross
Ranch Hand

Joined: Jan 17, 2001
Posts: 76
Hello,
I'm presently learning JDBC, I've done alot of examples for applications, as soon as I turned towards working with applets local in my pc (appletviewer), I've had problems.
I've study the tutorials on the web, and even with this example I found I'm getting errors.
The error is in the try ..... Class.forName
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
}
catch(Exception ex)
{
setError("Can't find Database driver class: " + ex);
return;
}
Has anyone seen this before?
Thanks
Phil
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

I've heard of some databases being 'picky' as to having '.newInstance()' tagged on to the end of the Class.forName method. try:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
-->doesn't have the newInstance() method at end.
Jamie
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Class.forName