| | |
how to connect java database MS access
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Feb 2007
Posts: 3
Reputation:
Solved Threads: 1
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
SN 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
}
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
SN 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
}
•
•
Join Date: Jul 2009
Posts: 3
Reputation:
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...!!
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...!!
•
•
Join Date: Jul 2009
Posts: 3
Reputation:
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...!!
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...!!
![]() |
Similar Threads
- How to connect MSAccess database in ASP.NET (C#)
- How to connect Oracle database from JSP page (Java)
- java database connectivityl (Java)
- How to generate SQL database to MS Access (MS Access and FileMaker Pro)
- how to connect oracle 8i database with jsp page (JSP)
- need your help with database access (Visual Basic 4 / 5 / 6)
- Database access with Java platform (MS Access and FileMaker Pro)
- shortcut on client to connect to remote database filemaker (MS Access and FileMaker Pro)
- database access is getting slow day by day (MySQL)
- Writing to an Access Database using Java... (Java)
Other Threads in the Java Forum
- Previous Thread: Java programming Help required!!! Please HELP!?
- Next Thread: show JPanel in netbean
| Thread Tools | Search this Thread |
2dgraphics account android api apple applet application array arrays automation banking binary binarytree bluetooth chat chatprogramusingobjects class classes client code component data database derby design draw eclipse encryption error event exception fractal game givemetehcodez graphics gui html ide if_statement image inheritance input integer interface j2me java javadesktopapplications javaprojects jlabel jni jpanel jtextfield julia linux list loop map method methods midlethttpconnection mobile monitoring netbeans newbie nullpointerexception open-source oracle print printing problem program programming project property recursion reference ria scanner screen search server set size sms sort sourcelabs splash sql static stop string swing testautomation threads time tree ui unicode validation windows






