• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC or ODBC and Excel

 
C. Patty
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Help!
I am trying to connect an Excel 2000 to ODBC or whatever I need to use.
Specifically, here is the data needed:
1)DB connection URL
2)Driver file - where do I get this?
3)Driver class
4)Username
5)password
6)catalog
7)schema
Any help would be greatly appreciated!!!
Thank you.
Patty
 
Joe Ess
Bartender
Posts: 9314
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out this Javaworld article. It should help you get started.
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to the JDBC/ODBC forum.
 
C. Patty
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe,
Thanks a lot!
Patty
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Patty C.
Hi, and Welcome to Javaranch.
Please change your Display Name to conform to our Naming Policy.
Last Name initials are not allowed. However, first name initials are, so you could change it to C. Patty, for example.
Thank you.
[ October 06, 2003: Message edited by: Gregg Bolinger ]
 
C. Patty
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe,
I looked at the article, but am confused about something:
The name of the Excel file is qa.xls, but it often refers to qa-list. Why does it add the -list on the end?
I am actually not working with Java code, but a tool instead that connects to a database and retreives it's structure.
1)It asks for a DB Connection URL. From the example, I would use
jdbc dbc:myExcelSheet ???
(What do I use if my spreadsheet file is myExcelSheet and the worksheet is "myExcelWorksheet"?)
2)It asks for you to browse to a jar file to be the driver. I saw how to "set-up" the driver, but I don't have anything tangible like a jar file to point to (browse to a jar file).
3)for driver class, I can use sun.jdbc.odbc.JdbcOdbcDriver it looks like from the code.
4)username and password, from the code, appear to be a blank space.
5)is also asks for schema and catalog when you do the reverse.
Thanks in advance for the help.
Patty
 
Sarath Mohan
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Patty,
It worked perfectly.
I will clear your doubt.
First of all.. qa-list is the ODBC name you have to give when you create the in Windows (2000).
The steps are
1. Click Start > Settings > Control Panel > Administrative Tool >Data Sources
2. It will open a window ODBC data souce Administrator
3. Select User DSN tab. If you want to acces from different machine use System DSN
4. Select Excel Files
5. Click add
6. Select Driver do for MicroSoft Excel
7. Click on Finish
8. Give datasource name... Here you can give qa-list as suggested in the article
9. You can skip description
10. Select workbook in your system You can use myExcelSheet stored in your system
11. Click OK.
Now you have added successfully an ODBC DSN for MS_Excel.. Here it's name is qa-list
Now copy the class file from the javaworld site.
Open the XL file (I hope it is qa.xls) and check the work sheet name
or
You can use [myExcelWorksheet$]. If you use your own worksheet... change the query accordingly...
(URL is the column header name used in the sample.. Change accordingly)

Save, compile and execute...
I hope this will help you
You will get the
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic