Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

connectivity between java and ms access

 
dhirajsrivastava
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
Can any one please tell me how can i connect jdk1.3 to ms acces as back end
thanks in advance
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your question is one that many people have asked. You are not alone. Try doing a search in this forum on "bridge" or "Access" and you will certainly find what you are looking for.
 
dhirajsrivastava
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all
can any one please give me the code for connectivity b/w java and ms access
and please specify the driver for this purpose
thanks
dhiraj
 
kichu kichu
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will send u the program tomorrow.
regards,
kichu.
 
kichu kichu
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai,
Sorry for the delay.Here is what u want.I have given below the getconnection java file.
dsn stands for Data Source Name.(Specify your dsn here).
package packagename;
import java.sql.*;
public class getconnection
{
public Connection getconnection(String dsn)
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc dbc:"+dsn;
Connection con=DriverManager.getConnection(url);
return con;
}
catch(ClassNotFoundException e)
{
System.out.println("class not found....");
return null;
}
catch(SQLException se)
{
System.out.println("unable to connect");
return null;
}
}
}

When u call this file from the jsp page,do the following.The code below has to be given in the jsp page.
*****************************************************************
getconnection gc=new getconnection();
Connection con=gc.getconnection(dsn);
*****************************************************************
This will pass dsn(Your data source name) to the java file.
regards,
kichu.
once again ,sorry for the delay!!!
[This message has been edited by kichu kichu (edited May 20, 2001).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic