Win a copy of Svelte and Sapper in Action this week in the JavaScript 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

how to connect sql server2008 with jsp

 
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Iam new to development field, i connect my jsp page with mysql server but now i wants to connect my sql server with my jsp page please guide me.


Please if any steps is there guide me.

Thanks in advance.
 
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Database access should not be done in a JSP. Rather, you should be using proper MVC architecture where DB access happens in the model.
 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arun,

refer the below link,

JSP + JDBC
 
Bear Bibeault
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
roseindia is well-know to be the worst place to rely upon for examples. Bad code and bad practices abound. I would not follow the practices shown at that link.
 
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Agree.. If you see the same link, they write Java code(connecting to database) inside JSP, which no good programmer in this era, would ever do..
 
Vicky Vijay
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault,


Can you suggest few Java reference websites (examples holding good practices), so that it would be helpful to refer it.

 
Bear Bibeault
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any that follow proper web application architecture that conform to Separation of Concerns, and that do not use Java scriptlets as if it were still 2001.
 
Ranch Hand
Posts: 541
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guru, what could be better place than Oracle Java website.
 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Plus see reources sections in https://coderanch.com/how-to/java/JspFaq
 
P Arunkumar
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi


I need any tutorials or links to develop my project with SQL server. please guide me.
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is your solution:

<% Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Connection con = DriverManager.getConnection("jdbc:sqlserver://localhost:1433/signin");
   Statement statement = con.createStatement() ;
ResultSet resultset = statement.executeQuery("select username from signintable") ;
%>
 
Master Rancher
Posts: 4668
49
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Bear says above (6 years ago), you don't want to have Java scriptlets in a JSP page.
 
This is my favorite show. And this is my favorite tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic