Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

connectivity in jsp

 
kashyap upadhyay
Greenhorn
Posts: 1
Java Netbeans IDE PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys!!
i am new in the java
i had facing one problem
can you teach me a connectivity in database using java server pages technology
thanks :
can you give me connectivity code?
please..reply..
 
Shinelin Samuel
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

What is your Database, you have to use the JDBC driver for thr database you are using. Here is the code snippet for JDBC connection for MYSQL database,




Go google my friend
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65105
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Database access should have nothing to do with JSP and vice versa. DB access should occur in the Model layer of a properly structured MVC application.

Moved to the JDBC forum.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shinelin Samuel wrote:
What is your Database, you have to use the JDBC driver for thr database you are using. Here is the code snippet for JDBC connection for MYSQL database,




Go google my friend



... though if you are using a Servlet container (as you must be if you are using JSPs) you might prefer using a DataSource. (Not sure what that is? Have a read through this)
 
him jain
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using windows and running Tomcat 6.0.24.
Is there any need to add any db etc in odbc?
I am trying to connect a servlet to database.
Please anyone tell me the configuration to be done..
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Him, what database? You do not need to set up anything in ODBC. You should get the JDBC driver for your database and use that.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic