File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Class.forName() missing type error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Class.forName() missing type error" Watch "Class.forName() missing type error" New topic
Author

Class.forName() missing type error

Nizan Horsefield
Ranch Hand

Joined: Jun 05, 2001
Posts: 42
When compiling I get the error
Missing type on declaration
Class.forName(String);
^
Why do I get this. Can anyone help?


Nizan Horsefield<BR>Sys Eng Internet Services<BR>Citibank
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
What are you passing to the method? We need to see some code in order to be able to help. The method call locates and loads the DB driver, and it expects a string.
Bosun


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Nizan Horsefield
Ranch Hand

Joined: Jun 05, 2001
Posts: 42
String url = "jdbc dbc://localhost/servers"; //can't get rid of the smiley!
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection(url);
I have tried substituting with a String and leaving it blank. Both give the same error.
Cheers

[This message has been edited by Nizan Horsefield (edited July 11, 2001).]
[This message has been edited by Nizan Horsefield (edited July 11, 2001).]
rani bedi
Ranch Hand

Joined: Feb 06, 2001
Posts: 358
can't figure out why are you getting such error.
Can you please show the whole code and the rroe message you are receiving.


Cheers,<br />Rani<br />SCJP, SCWCD, SCBCD
Nizan Horsefield
Ranch Hand

Joined: Jun 05, 2001
Posts: 42
Neither could I! However I have got it working now! IT was all to do with a } being in the wrong place! Threw off at tangents chasing this error.
Thanks for trying anyway,
Nizan.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Class.forName() missing type error
 
Similar Threads
mysql JDBC driver classpath problem.
Difference between Class.forName("ClassName") and ClassName.class
DB2 Hibernate Sequence generator mapping
Loading Driver.
Class.forName usage