Question about Sun Java Programming Language (cdj-275)

1 Answer

Mysql database tables+find new inserted or update row using java

I have to find newly inserted row in mysql database using java code and jdbc

Posted by on

1 Answer

  • Level 1:

    An expert who has achieved level 1.

  • Contributor
  • 2 Answers

After you add the new record into table A, you can use the LAST_INSERT_ID() function to retrieve the value of the auto_increment PK field. Look here for more information on this function: http://dev.mysql.com/doc/refman/5.0/en/information-functions.html

Posted on Mar 02, 2009

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

2 Answers

How to restore MySQL database Windows tool?


You can restore corrupt and delete SQL database file in few steps for MySQL Restore Toolbox. With this software you can also recover triggers, keys, indexes and table. Software support multiple MDF file recovery option. Software is supported by all Windows operating system. Get more ideas and download free trial version from -http://www.filerepairforum.com/forum/databases/databases-aa/mysql/1162-dump-mysql-database-file-is-error

May 29, 2015 | Sun MySQL

2 Answers

How to fix mysql error 1046?


For the database import, before you attempt to import the "flat" file data in, you need go to your local DB (MySQL) and create new database
After that you can import!
Also check this links:
http://www.repairtoolforsql.fixtoolbox.com/ Fix Toolbox for MySQL
http://www.sqlservercentral.com/Forums/Topic1618894-2893-1.aspx

Apr 09, 2015 | Quest Software Toad for MySQL

1 Answer

Mysql> desc contact_info -> ; --------------


Hi David,

It looks like you're missing two more null's in the third record, the column count is only 21 and you have 23 fields in your destination table.

All your data matches up to the columns, but you'll need to insert ", null, null" before the last paren to cover CompanyURL and companyPhone):

('Karson', 'B', 'Campbell', null, 'Dr.', 'Chief Resident', 'Pediatrics', 'kbc232@mvch.org', null, null, '585-544-1212', 'home', '1955-01-05', 'Wife: Molly Kids: Cassidy, Justine, and Cory.', 'Mountain View Hospital', null, null, null, null, null, null, null, null, null, null )

Sep 06, 2013 | Sun MySQL

1 Answer

I created a table using swing components but when i close the window the data enered are lost...how to get the data entered in the table ?or how to store?


hi dear,

the data you are entering stores in a temporay memory( ram in this case), which lost when you close your application.

> if you want to store your data so that you can again access it, you will have to store data in a DATABASE(by using jdbc) or in a file(simpler)

try this link
http://bytes.com/topic/java/answers/856588-saving-jtable-data

Apr 20, 2009 | ArcMedia JavaScript Source Code 3000 Pro...

2 Answers

Php counter


You might want to note that this is not the most effective manner of creating a counter in PHP. On a few of my websites, I find it is much more effective to simply create a text file, eg. counter.txt and have PHP read that every time the page is loaded, instead of running a MySQL query. Then, have PHP also update the counter.txt file by adding 1 to the number already listed in the file and read to the user.

Mar 19, 2009 | The PHP Group PHP

1 Answer

How to make a connection with sybase using jtds driver


hi,

the first thing you need is the correct JDBC driver, that must be included with your database.
Then you need to create a connection using the driver.

This link could help.

http://www.redmountainsw.com/wordpress/archives/jdbc-connection-urls

regards

Mar 13, 2009 | Sybase SQL Anywhere Studio for Workgroups...

1 Answer

Table creation via textfields using swings


import java.lang.Object;
import javax.swing.table.DefaultTableModel;


public class tabletest extends javax.swing.JFrame {
String[][] row = null;
String[] title=new String[3];
private int i;


/** Creates new form tabletest */
public tabletest() {
initComponents();
setTitle("table test");
setVisible(true);
System.out.print("NO Database Needed");
title[0]="Name";
title[1]="Desig";
title[2]="id";
}


/*
" In middle of this two source one generated code will be there that will be done by dragging ur fields to ur frame. THIS IS FOR netbeans IDE "
*/

private void b1ActionPerformed(java.awt.event.ActionEvent evt) {
row=new String[4][3];
// TODO add your handling code here:

String s1=t1.getText();
System.out.println(" event 1");
String s2=t2.getText();
System.out.println(" event 2");
int k=Integer.parseInt(t3.getText());
String s3=""+k;
System.out.println(" event 3");
try{
// for(int i=0;i<=2;i++)
row[i][0]=s1;
row[i][1]=s2;
row[i][2]=s3;
i++;

}catch(Exception e){
e.printStackTrace();

}
table.setModel(new DefaultTableModel(row,title));
}

private void b2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:

t1.setText("");
t2.setText("");
t3.setText("");

}

/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new tabletest().setVisible(true);
}
});
}

// Variables declaration - do not modify
private javax.swing.JButton b1;
private javax.swing.JButton b2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JPanel jPanel1;
private javax.swing.JLabel l1;
private javax.swing.JLabel l2;
private javax.swing.JLabel l3;
private javax.swing.JPanel p2;
private javax.swing.JScrollPane scp1;
private javax.swing.JTextField t1;
private javax.swing.JTextField t2;
private javax.swing.JTextField t3;
private javax.swing.JTable table;
// End of variables declaration

}

Mar 13, 2009 | Compilers & Programming Tools

1 Answer

Steps and definition of ReOrganizing mysql Database


I can't really tell what you mean by "re-organizing" a database. Some things this could include are:

  • Creating new tables
  • Deleting unused tables
  • Changing the structure of the database's tables (adding fields, removing fields, moving fields between tables, etc.)

Aug 28, 2008 | Sun MySQL

4 Answers

Table Repair MySQL


MySQL offers Check Table syntax that checks a table or tables for errors. It works for several storage engines like MyISAM, InnoDB, & Archive. If you run this syntax then you can the cause of problem & reported tables.

If Check Table finds errors then you can repair reported tables by Repair MySQL Table syntax.

Aug 06, 2008 | Sun MySQL

1 Answer

Table not gettin updated


Generally database updates either require a commit to have the database perform the appropriate checking and actually flag the rows as part of the database. That Commit can occur in two ways -- some databases can be setup with an auto commit or auto rollback when the database is disconnected. The first means the programmer needs to do nothing. The second means if the programmer does not commit the updates are backed out of the database. To commit is generally considered bad because if there are any data errors partial transactions and logically inconsistent contents can exist in a database. For example entering an order for merchandise requires a single header row to identify the customer and multiple items rows to indicate what was ordered. If the third item record added to an order had an error and the application did not rollback and the database auto committed and incomplete order with only two items would be saved in the database. Traditionally databases with an automatic action at shutdown are set to rollback to assure such partial information is not saved. Even with auto rollback good programs detect errors and rollback themselves and allow users to continue.

The net result of the above is the probability that if the inserts actually occurred as you believe the there was a missing commit to confirm their addition to the database. and an automated rollback kept them from being completely added to the database. Another alternative is that the insert was not error checked in the program code and it failed meaning despite the program counter claiming rows were inserted in fact they were not.

Dec 07, 2007 | Compilers & Programming Tools

Not finding what you are looking for?
Compilers & Programming Tools Logo

Related Topics:

363 people viewed this question

Ask a Question

Usually answered in minutes!

Top Sun Compilers & Programming Tools Experts

Robin Hill
Robin Hill

Level 3 Expert

1251 Answers

Les Dickinson
Les Dickinson

Level 3 Expert

18298 Answers

Justin
Justin

Level 3 Expert

2072 Answers

Are you a Sun Compiler and Programming Tool Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...