I am newbie to
Java &
JSP.
i'm using the following code in java file....can we use the same code in jsp file in scriptlet or as javascript......
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
/* Setup the connection */
Connection connection = DriverManager.getConnection ("jdbc
dbc:emp");
/*set auto commit to false*/
connection.setAutoCommit(false);
/*create statement*/
Statement statement = connection.createStatement();
/*
String str = "insert into EmployeeData values '1','kirti','A',23100,'rtm','prakash')";*/
String str = "select * from EmployeeData where EmpID = '" + emp.getJ_empID() +"'";
/* Store no. of rows updated in result */
ResultSet rs = statement.executeQuery(str);
i'm trying to use it in javascript and for using that i'm impoting following in page directive as
<%@ page language="java" import="java.sql.Connection, java.sql.DriverManager, java.sql.ResultSet, java.sql.SQLException, java.sql.Statement" %>
but it is not working is there any other way to use this...
My objective is to get connect to database in JSP....
Please suggest other ways
Thanks in ADV...