DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   JSP (http://www.daniweb.com/forums/forum24.html)
-   -   JSP connection to database (http://www.daniweb.com/forums/thread22781.html)

nelly_1005 Apr 29th, 2005 7:04 am
JSP connection to database
 
hi guys

hope you can help

well im tryin to connect my jsp to my database, im uisng tomcat 5 and have stored the MS access database in my ROOT folder.

i have created a User DNS, and have sdk 1.4.2_08 installed

Problem is im not sure what to do now??

do i have to install a sun driver? if so how?

and finally how do i connect to teh database?

Please help thanks! x

adityabakle May 1st, 2005 6:27 am
Re: JSP connection to database
 
Hi nelly

No need to do much
I hope u are aware of JDBC-ODBC Driver and they are supported by sdk1.4

First create a DSN using ODBC in control pannel
later for JSP to connect to Database

use the following code

<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection("jdbc:odbc:<DSN name>")
%

provide DSN name after the second colon.
In this way you are connected to your data base and you can futher query your database using statement object .

For futher help
mail adityabakle@gmail.com


All times are GMT -4. The time now is 2:25 am.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC