Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Jdbc

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need some help. I'm trying to connect to a database I created in MS ACCESS the file name is db challenge.mdb
would somebody heip me out ? Please.
I'm getting 3 errors on lines 44,47,52 saying cannot find symbol variable rowSet
1 error on line 26 that say's cannot find symbol method JdbcRowSetImpl()
1 error on line 28 that say's cannot find symbol method setUserName(java.lang.String)


 
Sheriff
Posts: 21972
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, the variable is called rowset, not rowSet

Second of all, don't do it this way! Whenever using JDBC, you should do the following:
 
Curtis Bridges
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, Rob,
I changed rowset as suggested. Inserted your code but am still getting errors on # 29
cannot find symbol variable DriverManager,cannot find symbol class Connection
# 31 cannot find symbol class Statement
# 35 cannot find symbol variable ResultSet
# 39 and # 42 cannot find symbol variable rs
Any ideas? New code below.


 
author
Posts: 23878
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I need some help. I'm trying to connect to a database I created in MS ACCESS the file name is db challenge.mdb
would somebody heip me out ? Please.



If you are trying to connect to a access database named challenge, then why are you using the mysql driver and connecting to books?



Henry
 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can make it easier for yourself by using

instead of

That way you'll cover the ResultSet, Statement and other related classes as well.
 
Rob Spoor
Sheriff
Posts: 21972
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The errors about DriverManager, Statement and ResultSet were because you didn't import them; Ulf's suggestion should solve that.

As for the rs part, you forgot it in your code:
 
Curtis Bridges
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
/*Thanks guys. We have this down to 1 error on line # 15 <identifier> expected.
I think it's something else though, but can't figure it out.
It's thowing an exception now.

java.lang.NoClassDefFoundError: JdbcRowSetTest
Exception in thread "main"

The compiler keeps wanting ";"on the last 2 lines
Please help.
Curt
*/
 
Henry Wong
author
Posts: 23878
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


static final String DRIVER = "com,mysql.jdbc.Driver";
static final String DATABASE_URL = "jdbc:mysql://localhost/db challenge.mdb";



This isn't going to work... The mysql driver will not work for access. You need to get an access driver from Microsoft -- or use the JDBC/ODBC bridge. As for the format of the URL, there is no standard -- you have to use the format as defined for the driver that you using. Using the mysql format isn't going to work for the access driver, once you install it.

Henry
[ October 02, 2007: Message edited by: Henry Wong ]
 
Rob Spoor
Sheriff
Posts: 21972
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the following:
Driver = "sun.jdbc.odbc.JdbcOdbcDriver"
Database URL = "jdbc: odbc: DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" followed by the filename. (Remove the spaces before odbc and DRIVER; I HATE these smileys!)
[ October 03, 2007: Message edited by: Rob Prime ]
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob - there's a 'Disable smilies in this post' option on the reply page.
 
Rob Spoor
Sheriff
Posts: 21972
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, I never saw it. Probably because it is just outside my screen
 
Can you smell this for me? I think this tiny ad smells like blueberry pie!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic