954,554 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

how to connect java database MS access

plz give me one example and how to generate Driver of data base

boyz
Light Poster
39 posts since Nov 2007
Reputation Points: 2
Solved Threads: 0
 
zandiago
Nearly a Posting Maven
2,480 posts since Jun 2007
Reputation Points: 129
Solved Threads: 26
 

Database drivers (jdbc,odbc,.net...) are provided by database vendors or third party vendors and not generated. JDBC drivers are loaded into the JVM at runtime.

Please refer some books on JDBC Connectivity

lookof2day
Junior Poster in Training
83 posts since Aug 2007
Reputation Points: 16
Solved Threads: 11
 

to connect ms access with java
you have to datasource name

and write this code in ur program

Connection con=null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:DSN name");
Statement stmt=con.createStatment();
ResultSet rs=stmt.executeQuery("select * from tablename");
while(rs.next())
{
System.out.println(rs.getSting("username"); //here username is the field name
}

muthulakshmil
Newbie Poster
3 posts since Feb 2007
Reputation Points: 10
Solved Threads: 1
 

the very first thing you need to do is to go to Control Panel --> adminstrative tools
then select the driver, and then your database

then you can write the code above mentioned in the reply above..
i guess that's pretty much it

7arouf
Light Poster
45 posts since Apr 2007
Reputation Points: 10
Solved Threads: 0
 

Thanks for the help Guys, but I need to insert values in the database and I am using PreparedStatement to do this, the problem is I have created an applet but I am failed to know where do I need to put the connection or put the PreparedStatement.

For Example :
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Class A extends Applet {
{
public void init()
{
TextField t = new TextField();
Button b = new Button("SubmitRecords");
add(t);
add(b);
}
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Now this code create a simple applet with one textbox and button, I need to use insert statement to send the value of "t" in a field called "Names" in database on clicking the SubmitRecords Button. I am confused with the placement of the PreparedStatement and Connection Objects. Kindly help...!!

varunnanda
Newbie Poster
4 posts since Jul 2009
Reputation Points: 10
Solved Threads: 0
 

Thanks for the help Guys, but I need to insert values in the database and I am using PreparedStatement to do this, the problem is I have created an applet but I am failed to know where do I need to put the connection or put the PreparedStatement.

For Example :
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Class A extends Applet {
{
public void init()
{
TextField t = new TextField();
Button b = new Button("SubmitRecords");
add(t);
add(b);
}
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Now this code create a simple applet with one textbox and button, I need to use insert statement to send the value of "t" in a field called "Names" in database on clicking the SubmitRecords Button. I am confused with the placement of the PreparedStatement and Connection Objects. Kindly help...!!

varunnanda
Newbie Poster
4 posts since Jul 2009
Reputation Points: 10
Solved Threads: 0
 

Check this link ( ) for a reply to your question. Here you will find detailed description of how to connect to a SQL server database from a Java database application and pass embedded SQL queries. It describes how to create the connection string, pass parameters to the embedded SQL queries and stored procedures.

SNK111
Newbie Poster
7 posts since Mar 2010
Reputation Points: 12
Solved Threads: 2
 

Thanks you very much, I am oblized.

varunnanda
Newbie Poster
4 posts since Jul 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You