Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC

 
zena sam
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a few questions regd JDBC/SQL?
can we connect to multiple databases from one application using JDBC?
how can we verify the results expected from a query with the results produced....if the expected results are stored in a excel sheet?
Thanks in Advance!!
 
Wayne L Johnson
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ONE: Yes, you can connect to multiple databases, and they can be of different types. So may have a connection to Sybase, two to Oracle, and one to MySQL. Just make sure you register all of the relevant drivers and then call DriverManager.getConnection(...) to create a connection to each database as needed. You just have to keep track of which connection is tied to which database so you process queries against the right database ...
TWO: How can you verify the results? Well, I guess you can save the results in any form you deem appropriate and compare it against what you expect. But if you submit the correct query, you'll get the correct results. JDBC has been in use for several years now and seems to work well ...
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17987
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's also at least one Excel JDBC driver. Or ability to read Excel using the JDBC-ODBC bridge, I forget which.
So you could do the "open more than one database" trick and one of the "databases" would be the Excel spreadsheet.
Just don't ask me how. I know it's possible, but for practical details, I'd have to RTFM
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic