Help coderanch get a
new server
by contributing to the fundraiser
  • 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

accesing a database

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would like my java server pages to interact with a database. I know this might not be as easy as it may seem. aside using JDBC which of course requires basic knowledge of SQL, I would like to know what other processes are involved in setting this up i.e. changes needed in the deployment desscriptor, JDBC drivers and any other needed information.
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The vendors jdbc driver is required. So is the class name and the database url (For sybase the driver is com.sybase.jdbc2.jdbc.SybDriver and the dbUrl would be something like jdbc:sybase:Tds: For mySql com.mysql.jdbc.Driver and jdbc:mysql://localhost/databasename?user=root).
Sybase requires you to install server side JDBC scripts/code. I'm not sure if other vendors require this or not. If you are using J2EE DataSources you need to use jndi to access the datasource, and set up the DataSource in the server (i.e. websphere, web logic, tomcat,...). I have a demo war available you can download at that has code to connect to Sybase ASE, Sybase ASA, MySQL, and HSQLDB.
This cake looks terrible, but it tastes great! Now take a bite out of this tiny ad:
We need your help - Coderanch server fundraiser
    Bookmark Topic Watch Topic
  • New Topic