This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How To Connect Jsp File With Microsoft SQL Server

 
subbu grandhi
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,


am new to JSP,Can anyone please teach me how to make a connection between jsp file and Microsoft SQL Server database steps by steps?

I installed MSSQLServer 2012 also I'm using Windows 7 and I found that my computer do not have JDBC (I already have ODBC). Is this mean that I have to install some JDBC or SQL driver in order to make the connection? Which driver should I install and where can I get the driver?

If possible, please show me some example so that I can understand better..Thanks a lot.

Regards,
Grandhi
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64713
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should not connect to your database in a JSP. In fact, there should be no code at all in a JSP. Java code in s JSP has been obsolete for 12 years! 12 years! Why would you be using such old and obsolete techniques that are considered a poor practice?

If you have Java installed, then you do have JDBC installed. What you probably don't have is the JDBC driver. You will need to obtain the JDBC driver for the particualr database that you will be using. Each database will have its own jar file that contains its JDBC driver. In your case, you'll need the one for SQL Server.

Once you have the driver, you should be using container-managed connection pooling in your web app, not grabbing connections yourself (and certainly not from a JSP).
 
subbu grandhi
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Bear Bibeault, sorry am new to java coding side,already I installed Java and database(sqlserver 2012) know,how will I connect database using jsp (means, java code inside JSP file ).

can you explain clearly or else If you know any tutorials I will read from there .

Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64713
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
subbu grandhi wrote:how will I connect database using jsp (means, java code inside JSP file ).

As I said, you don't. Especially if you are new to JSP, learning the right way to do things is very important. Putting Java code in a JSP is not the right way to do anything.

Have you found the right JDBC driver jar file that you need?
 
subbu grandhi
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Bear Bibeault, good morning,Still I didn't found it.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64713
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try google? sql server jdbc driver
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic