• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Class.forName() missing type error

 
Nizan Horsefield
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When compiling I get the error
Missing type on declaration
Class.forName(String);
^
Why do I get this. Can anyone help?
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Nizan Horsefield
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can't figure out why are you getting such error.
Can you please show the whole code and the rroe message you are receiving.
 
Nizan Horsefield
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic