Results 1 to 1 of 1
- 07-12-2010, 09:16 PM #1
Member
- Join Date
- Jul 2010
- Posts
- 1
- Rep Power
- 0
how to access derby database with servlets
i have created simple derby database and i m using glassfish server on netbeans 6.1 and i m not getting how to access it using servlets through which object
i tried with the following piece of code
import java.io.*;
import java.sql.*;
import javax.activation.DataSource;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.servlet.*;
import javax.servlet.http.*;
public class serv1 extends httpservlet(...)
{
.....
out.println("<body>");
context ct = new Initialcontext();
datasource ds = (datasource) ct.lookup();
// how to access a database using this lookup method
connection con = ds.getconnection(); // displaying error
statement st = con.createstatement();
.....
}
so there are two problems here
1: how to lookup
2: how to get connection
so is there any body here can solve my problemLast edited by Mateen; 09-07-2011 at 12:39 PM.
Similar Threads
-
Using Derby Database in Netbeans
By DavidG24 in forum New To JavaReplies: 1Last Post: 09-14-2009, 01:29 PM -
How to convert access database to mysql database?
By vrk in forum Advanced JavaReplies: 2Last Post: 02-11-2009, 04:43 AM -
saving date and time in a derby database from an ejb module
By Dave in forum Enterprise JavaBeans (EJB)Replies: 2Last Post: 07-22-2008, 11:14 AM -
File Access Through Servlets
By bipinkrishna15 in forum Java ServletReplies: 1Last Post: 05-27-2008, 10:58 AM -
Help with access a database using Microsoft Access
By cachi in forum JDBCReplies: 1Last Post: 08-07-2007, 07:51 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks