aspose file tools*
The moose likes JSP and the fly likes How To Connect Jsp File With Microsoft SQL Server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "How To Connect Jsp File With Microsoft SQL Server" Watch "How To Connect Jsp File With Microsoft SQL Server" New topic
Author

How To Connect Jsp File With Microsoft SQL Server

subbu grandhi
Greenhorn

Joined: Jun 11, 2013
Posts: 22
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

Joined: Jan 10, 2002
Posts: 61612
    
  67

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).


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
subbu grandhi
Greenhorn

Joined: Jun 11, 2013
Posts: 22
@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

Joined: Jan 10, 2002
Posts: 61612
    
  67

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

Joined: Jun 11, 2013
Posts: 22
@Bear Bibeault, good morning,Still I didn't found it.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61612
    
  67

Did you try google? sql server jdbc driver
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How To Connect Jsp File With Microsoft SQL Server