• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

servlet jdbc

 
Ranch Hand
Posts: 172
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone am using windows 7 64 bit operating system and developing my first servlet which contains a database in it. can anybody tell me which DBMS should i use so that i can create a table and save records in it? Many thanks!!!
 
Bartender
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any relational DB can do that: Derby, HsqlDB, MySQL, PostgreSQL, Oracle, Informix, DB2, SQLServer, Sybase, ... That has nothing to do with servlets, though.
 
Pranit Sonawane
Ranch Hand
Posts: 172
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply Tim, but i tried using oracle but unfortunately there is no driver available with windows 7 64 bit like it needs ODBC driver for creating a dsn connection. many thanks..!!!
 
Tim Moores
Bartender
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You definitely do not want to use ODBC with Oracle. On http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html I see no mention of any dependency of Oracle's JDBC drivers on some Windows version or other; are you sure about that?
 
Pranit Sonawane
Ranch Hand
Posts: 172
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tim, i have been taught that we should use JDBC-ODBC bridge and ODBC driver to connect your standalone or a web application to the database but i dont know if we can use or connect the application with the database using something else...please help..i know this may be funny for you but am sorry am very new to this all...thanks!!!
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Pranit Sonawane wrote:Hello everyone am using windows 7 64 bit operating system and developing my first servlet which contains a database in it. can anybody tell me which DBMS should i use so that i can create a table and save records in it? Many thanks!!!



- Don't bother to connect using ODBC - there are jdbc drivers available for all the database servers and they work very well because they were developed by the same people who developed the actual server. The fastest in my opinion is to install mysql (comes with a very handy msi installer) and download the jdbc driver from the same place.
- Please don't use the DriverManager.registerDriver approach to get the connection, rather install the jdbc jar file in the application server classpath (lib folder for tomcat 6 - 7) and register a data source.

- As it was mentioned in other messages from this forum, accessing database from the presentation tier or controller should be avoided and instead you should define a service tier and access it from there. But if you just want to "see how it works" that's different.

D.
 
Tim Moores
Bartender
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Pranit Sonawane wrote:Tim, i have been taught that we should use JDBC-ODBC bridge and ODBC driver to connect your standalone or a web application to the database


You need to unlearn that. The JDBC/ODBC bridge driver is buggy and not thread-safe; the latter point alone makes it unsuitable for web applications. The type of driver pretty much everyone uses these days is called type 4 driver, and that's what you'll find on that Oracle page.
 
Pranit Sonawane
Ranch Hand
Posts: 172
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for all of your posts..seems really helpful am still going to experience a problem. please stay in touch and help me out with this. Appreciate your honestly. Many Thanks!!!
 
Pranit Sonawane
Ranch Hand
Posts: 172
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Alright people now i need to download a database management system for my windows 7 64 bit please help me with this. I have oracle 10 g but dont have a driver to connect it and create a DSN. please help me with the link also. Many thanks!!!
 
Sheriff
Posts: 22818
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You do not want to use a DSN. That's still ODBC, and ODBC is terrible compared to a direct connection.
 
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try the following in your Java code to connect to Oracle DB. Also copy ojdbc14.jar file to your current working directory and set class path.



set classpath=%classpath%;currentworkingdirectorypath.ojdbc14.jar;.

(the . at the end of classpath is also needed to set it to the current directory)
This should work.

This is a type 4 driver and there is no need to set DSN for this.

Hope this helps
 
I guess I've been abducted by space aliens. So unprofessional. They tried to probe me with this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic