This week's book giveaway is in the Cloud forum.
We're giving away four copies of Terraform in Action and have Scott Winkler on-line!
See this thread for details.
Win a copy of Terraform in Action this week in the Cloud 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

database connectivity

 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I have an Access database and jdk 1.3. I want to query my database through a jsp page using beans.
what I need to connect to my database? any separate installation is required in order to use jdbc?
Regards,
mac.
 
Jimi Rock
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
plz some one answer me!!!
it urgent.
Regards.
 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
no seperate installation as long as u r willing to use jdbc.odbc.JdbcOdbcDriver
u need to import java.sql package
and load sun.jdbc.odbc.JdbcOdbcDriver using Class.forName()
 
Jimi Rock
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
thanks for reply.
can u provide me with the segment of code that will do the connection part?
Regards.
mac.
 
Ranch Hand
Posts: 1512
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
here is an example from one of my books....

try
{
// Load the driver class
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
// Define the data source for the driver
String sourceURL = "jdbc dbc:yourDataSourceName";
// Create a connection through the DriverManager
Connection databaseConnection =
DriverManager.getConnection(sourceURL);
}
catch(ClassNotFoundException cnfe)
{
System.err.println(cnfe);
}
catch(SQLException sqle)
{
System.err.println(sqle);
}
}

------------------
Bosun
 
Jimi Rock
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bosun,
thanks a lot for ur reply...
I have tried the code but have the following error:
"Data source name not found and no default driver specified"
this is may be becauae my connection url. I want to connect to an access database using jsp. servlet engine is tomcat.
what to do then?
Thanks in advance,
mac.
 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
U have to connect the database with ur frontend through Jdbc/Odbc driver.. and for that u have to use ODBC and connect through System DSN..
Pranit..

Originally posted by Jimi Rock:
Hi Bosun,
thanks a lot for ur reply...
I have tried the code but have the following error:
"Data source name not found and no default driver specified"
this is may be becauae my connection url. I want to connect to an access database using jsp. servlet engine is tomcat.
what to do then?
Thanks in advance,
mac.


 
Jimi Rock
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Pranit,
can u tell plz how to connect to system DSN?
Thanks.
 
Pranit Saha
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Assuming that u r using Windows.. Go to start->settings->control panel->ODBC drivers->click on system DSN.. and follow the steps as it says.. tell me if u face ne prob
Pranit..
 
Jimi Rock
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Pranit,
finally I have got it...
saying "Thank you" cannot express my appreciation...
Regards,
mac.
 
Pranit Saha
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's nice to hear that u've solved ur prob.. U r always welcome..
Pranit..

Originally posted by Jimi Rock:
Hi Pranit,
finally I have got it...
saying "Thank you" cannot express my appreciation...
Regards,
mac.


 
You showed up just in time for the waffles! And this tiny ad:
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
reply
    Bookmark Topic Watch Topic
  • New Topic