codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  MS Access connection in JSP  suneel.chiguruvada at 14:57 on Tuesday, February 08, 2005
 

Hi All,

i'm new to JSP
Can you please help me how to connect MS Access Database in JSP

Thanks
sunny

  Re: MS Access connection in JSP  vijaydaniel at 10:28 on Sunday, March 20, 2005
 

hi sir ,
i hope u remember me .the eagent project student

as i have worked a lot on jsp the following is correct for my knowledge.

<%@ page language="java" %>
<%@ page import ="java.sql.*" %>
.....

<%
Connection con=null;
PreparedStatement ps=null;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:db1");
....(using ps set strings)
ps.executeUpdate();
%>

  Re: MS Access connection in JSP  kanad at 14:38 on Wednesday, April 06, 2005
 

Try this

<%@ page language="java" %>
<%@ page import ="java.sql.*" %>

<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ= Authors.mdb";
;DriverID=22;READONLY=true}";
Connection con = DriverManager.getConnection( database ,"","");

%>

<Added>

Try this

<%@ page language="java" %>
<%@ page import ="java.sql.*" %>

<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ= C:\Authors.mdb";
;DriverID=22;READONLY=true}";
Connection con = DriverManager.getConnection( database ,"","");

%>



  Re: MS Access connection in JSP  hira at 14:00 on Friday, March 10, 2006
 

hi kanad sir,
i used this tips but there is a error which is follows
Generated servlet error:
String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\university.mdb;DriverID=22;READONLY=true;";
please help to remove this error



  Re: MS Access connection in JSP  vijaydaniel at 03:35 on Monday, March 13, 2006
 

hi,
i feel this error does not rise..
check once more

daniel

  Re: MS Access connection in JSP  wst at 10:10 on Monday, July 24, 2006
 

Hi daniel,
if you need further help,
this is my connection to MSAccess with jsp:

<%@ page language="java" %>
<%@ page import ="java.sql.*" %>
<%
String sOrder = "";
if( request.getParameterNames().hasMoreElements() == true )
{
sOrder = request.getParameter( "order" );
}
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String sTable = "AbTabelle2";
String sSql = "SELECT * FROM " + sTable + " order by [" + sOrder + "]";
String sDBQ = "C://test/test.mdb";

String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=" + sDBQ + ";DriverID=22;READONLY=true";
Connection cn = null;
Statement st = null;
ResultSet rs = null;
try {
cn = DriverManager.getConnection( database ,"","");
st = cn.createStatement();
rs = st.executeQuery( sSql );
ResultSetMetaData rsmd = rs.getMetaData();
int n = rsmd.getColumnCount();
out.println( "<table border=1 cellspacing=3><tr>" );
for( int i=1; i<=n; i++ ) // Achtung: erste Spalte mit 1 statt 0
out.println( "<th>" + rsmd.getColumnName( i ) + "</th>" );
while( rs.next() )
{
out.println( "</tr><tr>" );
for( int i=1; i<=n; i++ ) // Achtung: erste Spalte mit 1 statt 0
out.println( "<td nowrap>" + rs.getString( i ) + "</td>" );
}
out.println( "</tr></table>" );
} finally {
try { if( null != rs ) rs.close(); } catch( Exception ex ) {}
try { if( null != st ) st.close(); } catch( Exception ex ) {}
try { if( null != cn ) cn.close(); } catch( Exception ex ) {}
}

%>

and this the index.htm to call the above x1.jsp

<HTML>
<head>
<title>test</title>
</head>
<body>
<table align="left">
<tr><td><b>test - order by<b></td></tr>
<tr><td><font size="+0.5">
<a href="http://localhost:8080/test/x1.jsp?order=Name">» Namen «</a><br>
<a href="http://localhost:8080/test/x1.jsp?order=gebAm">» Geburtsdatum «</a><br>
<a href="http://localhost:8080/test/x1.jsp?order=GebOrt">» GeburtsOrt «</a><br>
<a href="http://localhost:8080/test/x1.jsp?order=ID">» ID «</a><br>
<a href="http://localhost:8080/test/x1.jsp?order=AendAm">» AenderungsDatum «</a><br>
</table>
</body>
</HTML>

so long ...
WST


  Re: MS Access connection in JSP  sam123 at 18:25 on Tuesday, April 06, 2010
 

i need help for developing an online survey app...

in netbeans using java and jsp..and database has 2 b stored in ms access

  Re: MS Access connection in JSP  sam123 at 18:26 on Tuesday, April 06, 2010
 

can u help me 2 make a online survey app in netbeans..using java and jsp ...and d database has 2 b saved in ms access...pls....









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
• SoftIce Driver Suite 3.0.1
• metrowerks codewarrior 9.0
• Mapinfo.Professional.v7.0
• GardenGraphics DynaSCAPE Professional 3.02
• Embroidery Great Notions 2004 part01-74
• EFI_BEST_COLORPROOF_V5.0
• AViD.SOFTiMAGE.XSi.V4.2.CD1-NNiSO
• AUTOFX.PHOTOGRAPHIC.EDGES.6.0.CD1
• 0 STI.SASSPro.v2.0.0.2 working full


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2014