Mysql auto_increment.

I'm trying to use jdeveloper to desing my db structure using mysql, how i set an id field as autoincrement ?
thanks in advance.

Actually, I believe that the auto-increment support is in the current
2.5.0 release (beta 2).
-Patrick
On Fri, 11 Apr 2003 22:11:02 -0400, Marc Prud'hommeaux wrote:
Note that the feature isn't available in the current beta, but it will
be available in the final release (which will be out "real soon now").
In article <[email protected]>, Abe
White wrote:
I believe we've added some auto-increment support in our 2.5 beta,
available here:
http://solarmetric.com/Software/beta/2.5.0
Patrick Linskey
SolarMetric Inc.

Similar Messages

  • Mysql's auto_increment in berkeley db

    Hi,
    I am coming to BDB from MySQL. I am using C API to create my first example.
    Q: What would be the equivalent of MySQL's auto_increment field type in BDB ?
    I read the docs, and it says QUEUE access type will use immutable record numbers, does it mean I can rely on it "forever"? Can i store them in another databases and assume the record will never change its record number unless it is deleted? (this is how it works in MySQL)
    I also read about SEQUENCE type fields and saw the example. Just in case QUEUE's record doesn't behave like MySQL auto_increment I can go for DB_SEQUENCE, I just need to clear things up with the first question, because if QUEUE works for me using DB_SEQUENCE will be wasting precious CPU cycles.
    Thanks in advance

    user3882275 wrote:
    Q: What would be the equivalent of MySQL's auto_increment field type in BDB ?
    I read the docs, and it says QUEUE access type will use immutable record numbers, does it mean I can rely on it "forever"? Can i store them in another databases and assume the record will never change its record number unless it is deleted? (this is how it works in MySQL)A B-Tree access method stores data in a B+Tree and provides fast serial and random access to data. A Hash database stores data in a hash table and provides slightly faster random access to data. A Queue database stores data in a FIFO queue and a Recno database stores data using an increasing record number, no key is required.
    Logical record numbers can be mutable or fixed: mutable, where logical record numbers can change as records are deleted or inserted, and fixed, where record numbers never change regardless of the database operation. It is possible to store and retrieve records based on logical record numbers in the Btree access method. However, those record numbers are always mutable, and as records are deleted or inserted, the logical record number for other records in the database will change. The Queue access method always runs in fixed mode, and logical record numbers never change regardless of the database operation. The Recno access method can be configured to run in either mutable or fixed mode.
    So yes, when using the Queue access method, you can rely on it "forever". You can also use the Recno access method and configure it to run in the fixed mode.
    Selecting an access method - http://download.oracle.com/docs/cd/E17076_02/html/programmer_reference/am_conf_select.html
    Hope this helps,
    Bogdan Coman

  • JPA cascade with  @GeneratedValue(strategy=GenerationType.IDENTITY)

    If anyone has got cascading persistance working in JPA with database generated primary keys I'd be much obliged if you could let me know how.
    Am attempting to use tables with database auto generated primary keys (MySQL AUTO_INCREMENT), and using the JPA cascade features. But I can't see how to make it work.
    The problem is that if you cascade persist a series of entities, you need to know the database primary keys before you persist to the database.
    If I remove all the cascades in my @entity's, and explicitly persist entities in the correct order so the primary keys are set before them being needed, then all is ok.
    When I put the cascades in, my JPA implementation (Toplink) attempts to create the entities with foreign keys to tables with the yet to be generated primary keys all null. I was hoping JPA/Toplink would be clever enough to persist the entities in order, setting the database generated primary keys as it went.
    Has anyone tried this in Hibernate?
    Sampe code exerts that does not work:
    @Entity
    public class Address implements Serializable {
       private long id;
       private Collection<Contact> contacts = new ArrayList<Contact>();
       @OneToMany(cascade = { CascadeType.ALL })
       public Collection<Contact> getContacts() {
          return contacts;
    @Entity
    public class Contact implements Serializable {
       private long id;
       @Id
       @Column(updatable = false)
       @GeneratedValue(strategy = GenerationType.IDENTITY)
       public long getId() {
          return this.id;
    CREATE TABLE address (
           id BIGINT NOT NULL AUTO_INCREMENT
         , address_line_1 VARCHAR(64)
         , address_line_2 VARCHAR(64)
         , address_line_3 VARCHAR(64)
         , suburb VARCHAR(64)
         , postcode VARCHAR(16)
         , state VARCHAR(64)
         , country_code CHAR(2)
         , PRIMARY KEY (id)
    CREATE TABLE contact (
           id BIGINT NOT NULL AUTO_INCREMENT
         , address_id BIGINT
         , contact_type CHAR(10)
         , value VARCHAR(255)
         , PRIMARY KEY (id)
         , INDEX (address_id)
         , CONSTRAINT FK_contact_address FOREIGN KEY (address_id)
                      REFERENCES address (id)
    );

    The way I have it, the contact does need annotations as it is a bidirectional link. The contact defines the link and the address has a mappedBy="address".
    If you remove the annotations on contact, I think you will need to set up a unidirectional one-to-many link and my 'text book' says you need to have a join table to implement this. I tried all kinds of ways to have a unidirectional one-to-many link without a join table, but never succeeded.
    I found if a persist failed it would still use up sequence numbers (Hibernate and MySQL), but I did not come accross your problem. I found it useful to look on the SQL Database logs to see exactly what SQL was getting to the server.
    My code - so far working fine, am in mid development though.
    Address.java:
    @Entity
    @Table(name = "address", schema = "z")
    public class Address implements Serializable {
       private static final long serialVersionUID = 1L;
       private long id;
       private String addressLine1;
       private Collection<Contact> contacts = new ArrayList<Contact>();
       public Address() {
          super();
       @Id
       @Column(updatable = false)
       @GeneratedValue(strategy = GenerationType.IDENTITY)
       public long getId() {
          return this.id;
       public void setId(long id) {
          this.id = id;
       @Column(name = "address_line_1")
       public String getAddressLine1() {
          return this.addressLine1;
       public void setAddressLine1(String addressLine1) {
          this.addressLine1 = addressLine1;
       @OneToMany(mappedBy="address", cascade={CascadeType.ALL})
       public Collection<Contact> getContacts() {
          return contacts;
       public void setContacts(Collection<Contact> contacts) {
          this.contacts = contacts;
    Contact.java:
    @Entity
    @Table(name = "contact", schema = "z")
    public class Contact implements Serializable {
       private static final long serialVersionUID = 1L;
       private long id;
       private Address address;
       private String value;
       private String contactType;
       public Contact() {
          super();
       @Id
       @Column(updatable = false)
       @GeneratedValue(strategy = GenerationType.IDENTITY)
       public long getId() {
          return this.id;
       public void setId(long id) {
          this.id = id;
       @ManyToOne (cascade={CascadeType.ALL})
       @JoinColumn(name="address_id", referencedColumnName="id", nullable=false, updatable=false)
       public Address getAddress() {
          return this.address;
       public void setAddress(Address address) {
          this.address = address;
       public String getValue() {
          return this.value;
       public void setValue(String value) {
          this.value = value;
       @Column(name = "contact_type")
       public String getContactType() {
          return this.contactType;
       public void setContactType(String contactType) {
          this.contactType = contactType;
    }

  • MYSQL_UTILITIES

    Hi all, i'm migrating some MYSQL databases using SQLDeveloper 1.5.3. I know that Oracle simulates mysql auto_increment property using sequences and triggers but when i generate and create all objects the triggers are invalid and the error message is:
    19/4 PL/SQL: Statement ignored
    19/4 PLS-00201: identifier 'MYSQL_UTILITIES.IDENTITY' must be declared
    Any ideas about MYSQL_UTILITIES is?

    On translation of the tables the autoincrement is defined in a package of functions for mysql emulation. This will be created when you moved from the converted model to create the new oracle schema in Oracle
    B

  • How to retrieve the Identity/auto_increment fireld after an insert in MYSQL

    I have a table in MYSQL 5.0 with an auto_increment key. I can insert records into the table with no problems, but how do I know what the generated key is?
    Thanks for any help,
    Keith

    Hi,
    Can you be more precise?
    After inserting a records into the database the auto_increment field will be filled in automatically by mysql.
    When you run a SELECT * FROM <tablename> it will show up. If it shows up as 0 you forgot to refresh the dataprovider.

  • How to re-order automatically the number of primary key column in MySql that has been set as auto_increment if one of the row deleted?

    Hello,
    Can anyone show me the way how to re-oder automatically the number of primary key that has been set as auto_increment in mysql database when the row deleted?
    example:
    No (primary key=auto increment)|
    Name |
    AGE |
    1
        | JO
    | 21
    |
    2
        | Kyle
    | 25
    |
    3
        | Macy
    | 30
    |
    When delete 1 row:
    No (primary key=auto increment)|
    Name |
    AGE |
    1
        | JO
    | 21
    |
    2
        | Macy
    | 30
    |

    Hello,
    This is not a VB.NET question, best to ask this question in
    MySQL forum.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.

  • How to strart auto_increment from 500000? (mysql)

    Hi all,
    quick question, I have a table with the following prop:
    1. ID
    2. fname
    3. lname
    the Id is auto_increment. I wonder how can I start the count from say 50000?
    thank you

    thank you
    ALTER TABLE tbl AUTO_INCREMENT = 100;
    solved!

  • MySQL's AUTO_INCREMENT and JDBC

    I have the following that doesnt seem to work. The custID field i haven't specified in the prepare statement (because it's an AUTO_INCREMENT value , but for some reason it won't work without it. Nothing is added to the table when the method is completely run.
    int rows = 0;
    Connection conn = getConnection();
    PreparedStatement pstmt = null;
    try{
          pstmt = conn.prepareStatement(
         "insert into Customers values(" +
        "?," + //customername
           pstmt.setString(1, customerBean.getCustomerName());
    catch (SQLException se)
        rollback(conn);
        System.out.println(msg);
         System.out.println(se);
         throw new Exception(se);
    } | Field | Type | Null | Key | Default | Extra |
    -------------------------------------------------------------+
    | CUST_ID | int(11) | NO | PRI | NULL | auto_increment |
    | CUST_NAME | varchar(100) | YES | | NULL | |
    Any ideas? I want a proper way of forumlating a query using a prepared statement and using the AUTO_INCREMENT value so that when a new row is added the cust_Id field is incremented.
    Another question, why is the SQLException not being caught? I have another method which gets all the rows from a table, if i change the prepared statement to an invalid table then it gives me an exception. I was previously using Oracle, SQLException was being caught when a duplicate entry was added.

    Doesn't work :(
    try {
         Connection conn = getConnection();
         stmt = conn.createStatement();
         stmt.executeUpdate(
         "INSERT INTO Customers (customerName) "
         + "values ('Hello World')");
    Of course it doesn't work.
    1. That's not what was suggested.
    2. It's going to throw an exception, because you don't have a column named "customerName", you have a column IN THE DATABASE named "cust_name"

  • Generating CSV file with column names and data from the MySQL with JAVA

    Hi all,
    Give small example on ...
    How can I add column names and data to a CSV from from MySQL.
    like
    example
    sequence_no, time_date, col_name, col_name
    123, 27-apr-2004, data, data
    234, 27-apr-2004, data, data
    Pls give small exeample on this.
    Thanks & Regards
    Rama Krishna

    Hello Rama Krishna,
    Check this code:
    Example below exports data from MySQL Select query to CSV file.
    testtable structure
    CREATE TABLE testtable
    (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    text varchar(45) NOT NULL,
    price integer not null);
    Application takes path of output file as an argument.
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    public class automateExport {
        public static void main(String[] args) {
            DBase db = new DBase();
            Connection conn = db.connect(
                    "jdbc:mysql://localhost:3306/test","root","caspian");
            if (args.length != 1) {
                System.out.println(
                        "Usage: java automateExport [outputfile path] ");
                return;
            db.exportData(conn,args[0]);
    class DBase {
        public DBase() {
        public Connection connect(String db_connect_str,
                String db_userid, String db_password) {
            Connection conn;
            try {
                Class.forName("com.mysql.jdbc.Driver").newInstance();
                conn = DriverManager.getConnection(db_connect_str,
                        db_userid, db_password);
            } catch(Exception e) {
                e.printStackTrace();
                conn = null;
            return conn;
        public void exportData(Connection conn,String filename) {
            Statement stmt;
            String query;
            try {
                stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                        ResultSet.CONCUR_UPDATABLE);
                //For comma separated file
                query = "SELECT id,text,price into OUTFILE  '"+filename+
                        "' FIELDS TERMINATED BY ',' FROM testtable t";
                stmt.executeQuery(query);
            } catch(Exception e) {
                e.printStackTrace();
                stmt = null;
    Greetings,
    Praveen Gudapati

  • Why MYSQL error come

    when I deploy cmp bean on jboss-3.2.2 it gives following error (I use lomboz plugins):-
    5:53:11,197 INFO [EjbModule] Deploying FirstStat
    15:53:11,728 WARN [EntityContainer] No resource manager found for jdbc/MySqlDs
    15:53:13,320 ERROR [EntityContainer] Starting failed
    org.jboss.deployment.DeploymentException: Error in jbosscmp-jdbc.xml : datasource-mapping MYSQL not found
         at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCEntityMetaData.<init>(JDBCEntityMetaData.java:433)
         at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCApplicationMetaData.<init>(JDBCApplicationMetaData.java:310)
    Note:- Stateless or stateful bean created with dao, accessing of database normally.
    FirstStatBean.class
    * Created on Jan 23, 2006
    * TODO To change the template for this generated file go to
    * Window - Preferences - Java - Code Style - Code Templates
    package chaman.com;
    import java.rmi.RemoteException;
    import javax.ejb.EJBException;
    import javax.ejb.EntityBean;
    import javax.ejb.EntityContext;
    * <!-- begin-user-doc --> You can insert your documentation for '<em><b>FirstcmpBean</b></em>'. <!-- end-user-doc --> *
    <!-- begin-lomboz-definition -->
    <?xml version="1.0" encoding="UTF-8"?>
    <lomboz:EJB xmlns:j2ee="http://java.sun.com/xml/ns/j2ee" xmlns:lomboz="http://lomboz.objectlearn.com/xml/lomboz">
    <lomboz:entity>
    <lomboz:entityEjb>
    <j2ee:display-name>Firstcmp</j2ee:display-name>
    <j2ee:ejb-name>Firstcmp</j2ee:ejb-name>
    <j2ee:ejb-class>chaman.com.FirstcmpBean</j2ee:ejb-class>
    <j2ee:persistence-type>Container</j2ee:persistence-type>
    <j2ee:prim-key-class>java.lang.Integer</j2ee:prim-key-class>
    <j2ee:cmp-version>2.x</j2ee:cmp-version>
    <j2ee:abstract-schema-name>ecr</j2ee:abstract-schema-name>
    <j2ee:primkey-field>id</j2ee:primkey-field>
    </lomboz:entityEjb>
    <lomboz:fieldMappings>
    <lomboz:fieldName>id</lomboz:fieldName>
    <lomboz:fieldType>java.lang.Integer</lomboz:fieldType>
    <lomboz:columnName>id</lomboz:columnName>
    <lomboz:jdbcType>VARCHAR</lomboz:jdbcType>
    <lomboz:sqlType>INT</lomboz:sqlType>
    <lomboz:readOnly>false</lomboz:readOnly>
    <lomboz:primaryKey>true</lomboz:primaryKey>
    </lomboz:fieldMappings>
    <lomboz:fieldMappings>
    <lomboz:fieldName>fname</lomboz:fieldName>
    <lomboz:fieldType>java.lang.String</lomboz:fieldType>
    <lomboz:columnName>fname</lomboz:columnName>
    <lomboz:jdbcType>VARCHAR</lomboz:jdbcType>
    <lomboz:sqlType>VARCHAR</lomboz:sqlType>
    <lomboz:readOnly>false</lomboz:readOnly>
    <lomboz:primaryKey>false</lomboz:primaryKey>
    </lomboz:fieldMappings>
    <lomboz:fieldMappings>
    <lomboz:fieldName>lname</lomboz:fieldName>
    <lomboz:fieldType>java.lang.String</lomboz:fieldType>
    <lomboz:columnName>lname</lomboz:columnName>
    <lomboz:jdbcType>VARCHAR</lomboz:jdbcType>
    <lomboz:sqlType>VARCHAR</lomboz:sqlType>
    <lomboz:readOnly>false</lomboz:readOnly>
    <lomboz:primaryKey>false</lomboz:primaryKey>
    </lomboz:fieldMappings>
    <lomboz:fieldMappings>
    <lomboz:fieldName>phone</lomboz:fieldName>
    <lomboz:fieldType>java.lang.String</lomboz:fieldType>
    <lomboz:columnName>phone</lomboz:columnName>
    <lomboz:jdbcType>VARCHAR</lomboz:jdbcType>
    <lomboz:sqlType>VARCHAR</lomboz:sqlType>
    <lomboz:readOnly>false</lomboz:readOnly>
    <lomboz:primaryKey>false</lomboz:primaryKey>
    </lomboz:fieldMappings>
    <lomboz:tableName>address</lomboz:tableName>
    <lomboz:dataSourceName></lomboz:dataSourceName>
    </lomboz:entity>
    </lomboz:EJB>
    <!-- end-lomboz-definition -->
    * <!-- begin-xdoclet-definition -->
    * @ejb.bean name="Firstcmp"
    *     jndi-name="Firstcmp"
    *     type="CMP"
    * primkey-field="id"
    * schema="ecr"
    * cmp-version="2.x"
    * data-source=""
    * @ejb.persistence
    * table-name="address"
    * @ejb.finder
    * query="SELECT OBJECT(a) FROM ecr as a"
    * signature="java.util.Collection findAll()"
    * @ejb.pk class="java.lang.Integer"
    * @ejb.resource-ref res-ref-name="jdbc/MySqlDs"
    * res-auth="Container"
    * @jbos.resource-ref res-ref-name="jdbc/MySqlDs"
    * jndi-name="java:/MySqlDS"
    * <!-- end-xdoclet-definition -->
    * @generated
    public abstract class FirstcmpBean implements javax.ejb.EntityBean {
    protected EntityContext eContext;
    * <!-- begin-user-doc -->
    * The ejbCreate method.
    * <!-- end-user-doc -->
    * <!-- begin-xdoclet-definition -->
    * @ejb.create-method
    * <!-- end-xdoclet-definition -->
    * @generated
    public java.lang.Integer ejbCreate(Integer id, String fname,String lname, String phone ) throws javax.ejb.CreateException {
    // EJB 2.0 spec says return null for CMP ejbCreate methods.
    // TODO: YOU MUST INITIALIZE THE FIELDS FOR THE BEAN HERE.
    // setMyField("Something");
    // begin-user-code
         setId(id);
         setFname(fname);
         setLname(lname);
         setPhone(phone);
    return null;
    // end-user-code
    * <!-- begin-user-doc -->
    * The container invokes this method immediately after it calls ejbCreate.
    * <!-- end-user-doc -->
    * @generated
    public void ejbPostCreate(Integer id, String fname,String lname, String phone) throws javax.ejb.CreateException {
    // begin-user-code
    // end-user-code
    * <!-- begin-user-doc -->
    * CMP Field id
    * Returns the id
    * @return the id
    * <!-- end-user-doc -->
    * <!-- begin-xdoclet-definition -->
    * @ejb.persistent-field
    * @ejb.persistence
    * column-name="id"
    * jdbc-type="VARCHAR"
    * sql-type="INT"
    * read-only="false"
    * @ejb.pk-field
    * @ejb.interface-method
    * <!-- end-xdoclet-definition -->
    * @generated
    public abstract java.lang.Integer getId();
    * <!-- begin-user-doc -->
    * Sets the id
    * @param java.lang.Integer the new id value
    * <!-- end-user-doc -->
    * <!-- begin-xdoclet-definition -->
    * @ejb.interface-method
    * <!-- end-xdoclet-definition -->
    * @generated
    public abstract void setId(java.lang.Integer id);
    * <!-- begin-user-doc -->
    * CMP Field fname
    * Returns the fname
    * @return the fname
    * <!-- end-user-doc -->
    * <!-- begin-xdoclet-definition -->
    * @ejb.persistent-field
    * @ejb.persistence
    * column-name="fname"
    * jdbc-type="VARCHAR"
    * sql-type="VARCHAR"
    * read-only="false"
    * @ejb.interface-method
    * <!-- end-xdoclet-definition -->
    * @generated
    public abstract java.lang.String getFname();
    * <!-- begin-user-doc -->
    * Sets the fname
    * @param java.lang.String the new fname value
    * <!-- end-user-doc -->
    * <!-- begin-xdoclet-definition -->
    * @ejb.interface-method
    * <!-- end-xdoclet-definition -->
    * @generated
    public abstract void setFname(java.lang.String fname);
    * <!-- begin-user-doc -->
    * CMP Field lname
    * Returns the lname
    * @return the lname
    * <!-- end-user-doc -->
    * <!-- begin-xdoclet-definition -->
    * @ejb.persistent-field
    * @ejb.persistence
    * column-name="lname"
    * jdbc-type="VARCHAR"
    * sql-type="VARCHAR"
    * read-only="false"
    * @ejb.interface-method
    * <!-- end-xdoclet-definition -->
    * @generated
    public abstract java.lang.String getLname();
    * <!-- begin-user-doc -->
    * Sets the lname
    * @param java.lang.String the new lname value
    * <!-- end-user-doc -->
    * <!-- begin-xdoclet-definition -->
    * @ejb.interface-method
    * <!-- end-xdoclet-definition -->
    * @generated
    public abstract void setLname(java.lang.String lname);
    * <!-- begin-user-doc -->
    * CMP Field phone
    * Returns the phone
    * @return the phone
    * <!-- end-user-doc -->
    * <!-- begin-xdoclet-definition -->
    * @ejb.persistent-field
    * @ejb.persistence
    * column-name="phone"
    * jdbc-type="VARCHAR"
    * sql-type="VARCHAR"
    * read-only="false"
    * @ejb.interface-method
    * <!-- end-xdoclet-definition -->
    * @generated
    public abstract java.lang.String getPhone();
    * <!-- begin-user-doc -->
    * Sets the phone
    * @param java.lang.String the new phone value
    * <!-- end-user-doc -->
    * <!-- begin-xdoclet-definition -->
    * @ejb.interface-method
    * <!-- end-xdoclet-definition -->
    * @generated
    public abstract void setPhone(java.lang.String phone);
         /* (non-Javadoc)
         * @see javax.ejb.EntityBean#setEntityContext(javax.ejb.EntityContext)
         public void setEntityContext(EntityContext arg0) throws EJBException,
                   RemoteException {
              // TODO Auto-generated method stub
    this.eContext= arg0;
         /* (non-Javadoc)
         * @see javax.ejb.EntityBean#unsetEntityContext()
         public void unsetEntityContext() throws EJBException, RemoteException {
              // TODO Auto-generated method stub
    this.eContext=null;
    jbosscmp-jdbc.class
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE jbosscmp-jdbc PUBLIC "-//JBoss//DTD JBOSSCMP-JDBC 3.0//EN" "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_0.dtd">
    <jbosscmp-jdbc>
    <defaults>
    <datasource>java:/MySqlDS</datasource>
    <datasource-mapping>MYSQL</datasource-mapping>
    <preferred-relation-mapping>foreign-key</preferred-relation-mapping>
    </defaults>
    <enterprise-beans>
    <!--
    To add beans that you have deployment descriptor info for, add
    a file to your XDoclet merge directory called jbosscmp-jdbc-beans.xml
    that contains the <entity></entity> markup for those beans.
    -->
    <entity>
    <ejb-name>Firstcmp</ejb-name>
    <table-name>address</table-name>
    <cmp-field>
    <field-name>id</field-name>
    <column-name>id</column-name>
    <jdbc-type>VARCHAR</jdbc-type>
    <sql-type>INT</sql-type>
    </cmp-field>
    <cmp-field>
    <field-name>fname</field-name>
    <column-name>fname</column-name>
    <jdbc-type>VARCHAR</jdbc-type>
    <sql-type>VARCHAR</sql-type>
    </cmp-field>
    <cmp-field>
    <field-name>lname</field-name>
    <column-name>lname</column-name>
    <jdbc-type>VARCHAR</jdbc-type>
    <sql-type>VARCHAR</sql-type>
    </cmp-field>
    <cmp-field>
    <field-name>phone</field-name>
    <column-name>phone</column-name>
    <jdbc-type>VARCHAR</jdbc-type>
    <sql-type>VARCHAR</sql-type>
    </cmp-field>
    </entity>
    </enterprise-beans>
    </jbosscmp-jdbc>

    thank u for sending solution.
    cmp file successfully deployed but one prob. creats, when i send parameters values of
    create method (create("suman","kumar")) through client file, it inserts data correctly in table
    but it gives following error(Table stru:- (id int auto_increment primary key, fname varchar(20), lname varchar(20)):-
    javax.ejb.CreateException: Primary key for created instance is null.
         at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createEntity(JDBCStoreManager.java:520)
         at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:208)
         at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.createEntity(CachedConnectionInterceptor.java:269)
         at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:736)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(

  • Problem with getImportedKeys() in MySQL

    Hi everyone,
    I am using JDK1.5.0 and the jdbc "mysql-connector-java-3.0.16"
    I've been trying to get the foreign keys from a MySQL 4.1 database using the getImportedKeys() method of the DatabaseMetaData class,but the method returns a ResultSet,which is null!
    However, I noticed that the getPrimaryKeys() method (which needs the same arguments as the getImportedKeys() one) works just fine and that puzzles me.
    Can anybody help me? Is this a known bug of MySQL?
    Thanks in advance.

    Indeed,previous MySQL versions did not support foreign keys...
    However,MySQL Server 4.1 allows foreign keys as you can see:
    CREATE TABLE `companies` (
    `Company_Id` int(6) unsigned NOT NULL auto_increment,
    `Name` varchar(11) default NULL,
    `Artist_Id` int(6) unsigned NOT NULL default '0',
    PRIMARY KEY (`Company_Id`),
    KEY `Artist_Id` (`Artist_Id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    INSERT INTO `companies` VALUES (1,'heaven',1);
    INSERT INTO `companies` VALUES (2,'emi',3);
    # Foreign keys for table companies
    ALTER TABLE `companies`
    ADD FOREIGN KEY (`Artist_Id`) REFERENCES `artists` (`Artist_Id`);
    Any further help? :-)

  • Select returns negative values for unsigned datatypes in MySQL DB

    Hi, I have a table in a MySQL database where some fields are declared as "unsigned".
    Example:
    CREATE TABLE countries (
    Country_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
    Number SMALLINT UNSIGNED NOT NULL
    My problem is when inside a .xsql file, I try to do a select:
    <xsql:query>
    select Number from countries where Country_id="15"
    </xsql:query>
    If inside the Database, Number always goes from 0 to 65535 (UNSIGNED SMALLINT),
    the resulting XML of that query will always show negative values if Number is
    bigger than 32767 (so it ignores the "UNSIGNED").
    Have you seen something like this before? Do you kwno what I'm doing wrong or what
    can I do to retrieve the values unsigned?
    Thanks a lot!
    David

    hi muneer
    >
    We are facing a strange issue in our R12.1.3 Ebiz instance (DB 11.2.0.1) - Solaris Sparc 64 bit - 2 node (1 node Apps, 1 node DB).
    Some of the purchase orders are having a negative purchase order number.
    SQL> select segment1 from PO_HEADERS_ALL where segment1 < '0';
    SEGMENT1
    -7951814
    -8960847please see
    Error: Purchase Order Creation Could Not Be Initiated, But PO Was Created With Negative PO Number And No Distributions [ID 789464.1]     To Bottom     
    PO Creation Process Failed In Sourcing And Creates Document With Negative Numbers [ID 1479616.1]
    Purchase Order Receipt FAQ (P4312) [ID 1306869.1]
    How it could happen. Any suggestions please !looks like a bug
    Can a Purchase Order (PO) Be Created With Negative Quantity or Price? [ID 241389.1]
    AppsMasti
    Sharing is caring

  • Help on locking MySQL tables (many can read, but only one can write) Java

    Hi there,
    I have a question regarding locking of tables so that only one person can write to the file, but many are able to read the files (or tables entities).
    I am not sure if I need to lock the tables in my Java code or do I lock the tables within the MySQL syntax. I'm just a little confused on the matter.
    This java code is a working prototype of inserting a customer data into the database and that works fine. I just don't know how to implement it so that only one person can update the table at a time.
    Here is the Customer.java code that I have written.
    Help would be greatly appreciated, thanks so much.
    package business;
    //~--- non-JDK imports --------------------------------------------------------
    import shared.info.CustomerInfo;
    //~--- JDK imports ------------------------------------------------------------
    import java.sql.*;
    * @author
    public class Customer {
        static Connection    con  = DBConnection.getConnection();
        private CustomerInfo info = new CustomerInfo();
        private String               customerID;
        private String               firstName;
        private String               lastName;
        private String               email;
        private String               addressID;
        private String               homePhone;
        private String               workPhone;
        private String               unitNum;
        private String               streetNum;
        private String               streetName;
        private String               city;
        private String               provinceState;
        private String               country;
        private String               zipPostalCode;
        public Customer(String id) {
            try {
                PreparedStatement pstmt = con.prepareStatement("SELECT * FROM " +
                        "Customer NATURAL JOIN Address WHERE CustomerID = ?");
                pstmt.setString(1, id);
                ResultSet rs = pstmt.executeQuery();
                while (rs.next()) {
                    customerID    = rs.getString("CustomerID");
                    firstName     = rs.getString("FirstName");
                    lastName      = rs.getString("LastName");
                    homePhone     = rs.getString("HomePhone");
                    workPhone     = rs.getString("WorkPhone");
                    email         = rs.getString("Email");
                    city          = rs.getString("City");
                    provinceState = rs.getString("ProvinceState");
                    country       = rs.getString("Country");
                    zipPostalCode = rs.getString("ZipPostalCode");
                    unitNum       = rs.getString("UnitNum");
                    streetNum     = rs.getString("StreetNum");
                    streetName    = rs.getString("StreetName");
                    addressID     = rs.getString("AddressId");
            } catch (SQLException e) {
                e.printStackTrace();
            info.setCustomerID(customerID);
            info.setFirstName(firstName);
            info.setLastName(lastName);
            info.setHomePhone(homePhone);
            info.setWorkPhone(workPhone);
            info.setEmail(email);
            info.setCity(city);
            info.setProvinceState(provinceState);
            info.setCountry(country);
            info.setZipPostalCode(zipPostalCode);
            info.setUnitNum(unitNum);
            info.setStreetNum(streetNum);
            info.setStreetName(streetName);
            info.setAddressID(addressID);
        public static void addCustomer(CustomerInfo cust) {
            try {
                int id = -1;
                PreparedStatement pstmt = con.prepareStatement("INSERT INTO Address" +
                        "(UnitNum, StreetNum, StreetName, City, ProvinceState, Country," +
                        " ZipPostalCode) VALUES(?, ?, ?, ?, ?, ?, ?)");
                pstmt.setString(1, cust.getUnitNum());
                pstmt.setString(2, cust.getStreetNum());
                pstmt.setString(3, cust.getStreetName());
                pstmt.setString(4, cust.getCity());
                pstmt.setString(5, cust.getProvinceState());
                pstmt.setString(6, cust.getCountry());
                pstmt.setString(7, cust.getZipPostalCode());
                pstmt.executeUpdate();
                ResultSet rs = pstmt.getGeneratedKeys();
                rs.next();
                id = rs.getInt(1);
                pstmt = con.prepareStatement("INSERT INTO Customer" +
                        "(FirstName, LastName, HomePhone, WorkPhone, Email, AddressID)"
                        + "VALUES(?, ?, ?, ?, ?, ?)");
                pstmt.setString(1, cust.getFirstName());
                pstmt.setString(2, cust.getLastName());
                pstmt.setString(3, cust.getHomePhone());
                pstmt.setString(4, cust.getWorkPhone());
                pstmt.setString(5, cust.getEmail());
                pstmt.setInt(6, id);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
        public void setFirstName(String newName) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Customer"
                                              + " SET FirstName = ? WHERE CustomerID = ?");
                pstmt.setString(1, newName);
                pstmt.setString(2, customerID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            firstName = newName;
        public void setLastName(String newName) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Customer"
                                              + " SET LastName = ? WHERE CustomerID = ?");
                pstmt.setString(1, newName);
                pstmt.setString(2, customerID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            lastName = newName;
        public String getFirstName() {
            return firstName;
        public String getLastName() {
            return lastName;
        public void setHomePhone(String number) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Customer"
                                              + " SET HomePhone = ? WHERE CustomerID = ?");
                pstmt.setString(1, number);
                pstmt.setString(2, customerID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            homePhone = number;
        public String getHomePhone() {
            return homePhone;
        public void setWorkPhone(String number) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Customer"
                                              + " SET WorkPhone = ? WHERE CustomerID = ?");
                pstmt.setString(1, number);
                pstmt.setString(2, customerID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            workPhone = number;
        public String getWorkPhone() {
            return workPhone;
        public void setEmail(String email) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Customer" + " SET Email = ? WHERE CustomerID = ?");
                pstmt.setString(1, email);
                pstmt.setString(2, customerID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            this.email = email;
        public String getEmail() {
            return email;
        public void setUnitNum(String num) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Address" + " SET UnitNum = ? WHERE AddressId = ?");
                pstmt.setString(1, num);
                pstmt.setString(2, addressID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            unitNum = num;
        public String getUnitNum() {
            return unitNum;
        public void setCity(String city) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Address" + " SET City = ? WHERE AddressId = ?");
                pstmt.setString(1, city);
                pstmt.setString(2, addressID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            this.city = city;
        public String getCity() {
            return city;
        public void setStreetNum(String num) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Address" + " SET StreetNum = ? WHERE AddressId = ?");
                pstmt.setString(1, num);
                pstmt.setString(2, addressID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            streetNum = num;
        public String getStreetNum() {
            return streetNum;
        public void setStreetName(String name) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Address"
                                              + " SET StreetName = ? WHERE AddressId = ?");
                pstmt.setString(1, name);
                pstmt.setString(2, addressID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            streetName = name;
        public String getStreetName() {
            return streetName;
        public void setZipPostalCode(String code) {
            try {
                PreparedStatement pstmt = con.prepareStatement("UPDATE Address"
                                              + " SET ZipPostalCode = ? WHERE AddressId = ?");
                pstmt.setString(1, code);
                pstmt.setString(2, addressID);
                pstmt.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            zipPostalCode = code;
        public String getZipPostalCode() {
            return zipPostalCode;
        public CustomerInfo getInfo(){
            return info;
        static void deleteCustomer(String customerId) {
            try{
                PreparedStatement pstmt = con.prepareStatement("DELETE FROM Customer" +
                        " WHERE CustomerId = ?");
                pstmt.setString(1, customerId);
                pstmt.executeUpdate();
            }catch(SQLException e){
                e.printStackTrace();
        static void updateCustomer(CustomerInfo custInf) {
            try{
                PreparedStatement pstmt = con.prepareStatement("UPDATE customer" +
                        " SET firstName = ?, SET lastName = ?," +
                        " SET homePhone = ?, SET workPhone = ?, SET email = ?" +
                        " WHERE CustomerId = ?");
                pstmt.setString(1, custInf.getFirstName());
                pstmt.setString(2, custInf.getLastName());
                pstmt.setString(3, custInf.getHomePhone());
                pstmt.setString(4, custInf.getWorkPhone());
                pstmt.setString(5, custInf.getEmail());
                pstmt.setString(6, custInf.getCustomerID());
                pstmt.executeUpdate();
                pstmt = con.prepareStatement("UPDATE address" +
                        " SET unitNum = ?, SET StreetNum = ?, SET StreetName = ?," +
                        " SET city = ?,SET Province = ?,SET country = ?,SET ZipPostalCode = ?" +
                        " WHERE AddressId = ?");
                pstmt.setString(1, custInf.getUnitNum());
                pstmt.setString(2, custInf.getStreetNum());
                pstmt.setString(3, custInf.getStreetName());
                pstmt.setString(4, custInf.getCity());
                pstmt.setString(5, custInf.getProvinceState());
                pstmt.setString(6, custInf.getCountry());
                pstmt.setString(7, custInf.getZipPostalCode());
                pstmt.setString(8, custInf.getAddressID());
                pstmt.executeUpdate();
            }catch(SQLException e){
                e.printStackTrace();
    }In addition, here is my customer sql table.
    -- Table structure for table `customer`
    DROP TABLE IF EXISTS `customer`;
    CREATE TABLE `customer` (
    `CustomerID` mediumint(9) NOT NULL auto_increment,
    `FirstName` varchar(20) NOT NULL,
    `LastName` varchar(20) NOT NULL,
    `HomePhone` varchar(11) NOT NULL,
    `WorkPhone` varchar(11) default NULL,
    `Email` varchar(20) NOT NULL,
    `AddressID` mediumint(9) default NULL,
    PRIMARY KEY (`CustomerID`),
    KEY `AddressID` (`AddressID`),
    CONSTRAINT `customer_ibfk_1` FOREIGN KEY (`AddressID`) REFERENCES `address` (`AddressID`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    -- Dumping data for table `customer`
    LOCK TABLES `customer` WRITE;
    /*!40000 ALTER TABLE `customer` DISABLE KEYS */;
    /*!40000 ALTER TABLE `customer` ENABLE KEYS */;
    UNLOCK TABLES;

    to the best of my knowledge, this is something related to the database and not the programming. If you'd want to be the only user to read and edit the table, speicify only one user with that privilege and make it password protected. User must enter the password to write to the tables.

  • Need Help Connect to MySQL using dg4odbc

    I am looking for some help getting a dblink working from my Oracle 11.1.0.6 Dtabase to a MySQL 5.0.77 Database (Holds Bugzilla).
    This is the error I get when I try select * from "bugs"@bugz;
    ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
    [MySQL][ODBC 5.1 Driver][mysqld-5.0.77]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"bug_id" FROM "bugs" A1' at line 1
    ORA-02063: preceding 2 lines from BUGZ
    On Server hosting Oracle DB:
    lsb_release -id
    Distributor ID: RedHatEnterpriseServer
    Description: Red Hat Enterprise Linux Server release 5.7 (Tikanga)
    rpm -qa|grep mysql
    mysql-connector-odbc-5.1.8-1.rhel5
    mysql-5.0.77-4.el5_6.6
    tnsping BUGZ
    TNS Ping Utility for Linux: Version 11.1.0.6.0 - Production on 08-DEC-2011 07:53:52
    Copyright (c) 1997, 2007, Oracle. All rights reserved.
    Used parameter files:
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))) (CONNECT_DATA = (SID = BUGZ)) (HS = OK))
    OK (0 msec)
    tnsnames.ora
    BUGZ =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
        (CONNECT_DATA =
          (SID = BUGZ)
        (HS = OK)
      )listener.ora
    SID_LIST_LISTENER =
      (SID_LIST =
         (SID_DESC =
            (ORACLE_HOME = /u00/app/oracle/product/11.1.0/db_1)
            (SID_NAME = BUGZ)
            (PROGRAM = dg4odbc)
            (ENVS ="LD_LIBRARY_PATH=/u00/app/oracle/product/11.1.0/db_1/lib:/usr/lib64:/usr/lib")
    .../u00/app/oracle/product/11.1.0/db_1/hs/admin/initbugz.ora
    # This is a sample agent init file that contains the HS parameters that are
    # needed for the Database Gateway for ODBC
    # HS init parameters
    HS_FDS_CONNECT_INFO=bugz
    HS_FDS_TRACE_LEVEL=off
    HS_FDS_SHAREABLE_NAME=/usr/lib64/libmyodbc5.so
    HS_LANGUAGE=AMERICAN_AMERICA.WE8ISO8859P15
    # ODBC specific environment variables
    set ODBCINI=/u00/home/oracle/.odbc.ini
    # Environment variables required for the non-Oracle system
    set HOME=/u00/home/oracle
    ~/u00/home/oracle/.odbc.ini
    [ODBC Data Sources]
    [bugz]
    Driver      = /usr/lib64/libmyodbc5.so
    DATABASE    = bugzilla
    DESCRIPTION = MySQL ODBC 5.x Connector
    PORT        = 3306
    SERVER      = bugzilla
    UID         = bugquery
    PWD         = password
    CHARSET     = latin1
    TRACEFILE   = /tmp/myodbc-bugzdsn.trc
    TRACE       = OFFODBC Test
    isql -v bugz
    +---------------------------------------+
    | Connected!                            |
    |                                       |
    | sql-statement                         |
    | help [tablename]                      |
    | quit                                  |
    |                                       |
    +---------------------------------------+
    SQL> help bugs
    [Bunch of stuff omitted]
    SQLRowCount returns 31
    31 rows fetched
    SQL>

    I did the delete and reconnected and the rows where created again.
    I am testing with two SQL statements right now from TOAD and from SQLPlus.
    A. select bugs."bug_id" as Ticket, bugs."short_desc", bugs."bug_status" AS Status, bugs."assigned_to", dump(bugs."short_desc") from "bugs"@BUGZ bugs where "bug_id" = 2;
    B. select bugs."bug_id" as Ticket, bugs."short_desc", bugs."bug_status" AS Status, bugs."assigned_to" from "bugs"@BUGZ bugs
    When I issue "A" I get good looking results. When I issue "B" I get an error.
    SQL> select bugs."bug_id" as Ticket, bugs."short_desc", bugs."bug_status" AS Status, bugs."assigned_to", dump(bugs."short_desc") from "bugs"@BUGZ bugs where "bug_id" = 2;
        TICKET
    short_desc
    STATUS                                                           assigned_to
    DUMP(BUGS."SHORT_DESC")
             2
    COMA computer has updates set to auto install  please disable and allow me to ch
    oose
    CLOSED                                                                     8
    Typ=1 Len=168: 0,67,0,79,0,77,0,65,0,32,0,99,0,111,0,109,0,112,0,117,0,116,0,101
        TICKET
    short_desc
    STATUS                                                           assigned_to
    DUMP(BUGS."SHORT_DESC")
    ,0,114,0,32,0,104,0,97,0,115,0,32,0,117,0,112,0,100,0,97,0,116,0,101,0,115,0,32,
    0,115,0,101,0,116,0,32,0,116,0,111,0,32,0,97,0,117,0,116,0,111,0,32,0,105,0,110,
    0,115,0,116,0,97,0,108,0,108,0,32,0,32,0,112,0,108,0,101,0,97,0,115,0,101,0,32,0
    ,100,0,105,0,115,0,97,0,98,0,108,0,101,0,32,0,97,0,110,0,100,0,32,0,97,0,108,0,1
    08,0,111,0,119,0,32,0,109,0,101,0,32,0,116,0,111,0,32,0,99,0,104,0,111,0,111,0,1
        TICKET
    short_desc
    STATUS                                                           assigned_to
    DUMP(BUGS."SHORT_DESC")
    15,0,101
    SQL> select bugs."bug_id" as Ticket, bugs."short_desc", bugs."bug_status" AS Status, bugs."assigned_to" from "bugs"@BUGZ bugs;
    ERROR:
    ORA-28528: Heterogeneous Services datatype conversion error
    ORA-02063: preceding line from BUGZ
    no rows selectedThe bugs table looks like this:
    CREATE TABLE `bugs` (
      `bug_id` mediumint(9) NOT NULL auto_increment,
      `assigned_to` mediumint(9) NOT NULL,
      `bug_file_loc` mediumtext,
      `bug_severity` varchar(64) NOT NULL,
      `bug_status` varchar(64) NOT NULL,
      `creation_ts` datetime default NULL,
      `delta_ts` datetime NOT NULL,
      `short_desc` varchar(255) NOT NULL,
      `op_sys` varchar(64) NOT NULL,
      `priority` varchar(64) NOT NULL,
      `product_id` smallint(6) NOT NULL,
      `rep_platform` varchar(64) NOT NULL,
      `reporter` mediumint(9) NOT NULL,
      `version` varchar(64) NOT NULL,
      `component_id` smallint(6) NOT NULL,
      `resolution` varchar(64) NOT NULL default '',
      `target_milestone` varchar(20) NOT NULL default '---',
      `qa_contact` mediumint(9) default NULL,
      `status_whiteboard` mediumtext NOT NULL,
      `votes` mediumint(9) NOT NULL default '0',
      `lastdiffed` datetime default NULL,
      `everconfirmed` tinyint(4) NOT NULL,
      `reporter_accessible` tinyint(4) NOT NULL default '1',
      `cclist_accessible` tinyint(4) NOT NULL default '1',
      `estimated_time` decimal(7,2) NOT NULL default '0.00',
      `remaining_time` decimal(7,2) NOT NULL default '0.00',
      `deadline` datetime default NULL,
      `alias` varchar(20) default NULL,
      `cf_type` varchar(64) NOT NULL default '---',
      `cf_notes` mediumtext,
      `keywords` mediumtext NOT NULL,
      PRIMARY KEY  (`bug_id`),
      UNIQUE KEY `bugs_alias_idx` (`alias`),
      KEY `bugs_assigned_to_idx` (`assigned_to`),
      KEY `bugs_creation_ts_idx` (`creation_ts`),
      KEY `bugs_delta_ts_idx` (`delta_ts`),
      KEY `bugs_bug_severity_idx` (`bug_severity`),
      KEY `bugs_bug_status_idx` (`bug_status`),
      KEY `bugs_op_sys_idx` (`op_sys`),
      KEY `bugs_priority_idx` (`priority`),
      KEY `bugs_product_id_idx` (`product_id`),
      KEY `bugs_reporter_idx` (`reporter`),
      KEY `bugs_version_idx` (`version`),
      KEY `bugs_component_id_idx` (`component_id`),
      KEY `bugs_resolution_idx` (`resolution`),
      KEY `bugs_target_milestone_idx` (`target_milestone`),
      KEY `bugs_qa_contact_idx` (`qa_contact`),
      KEY `bugs_votes_idx` (`votes`),
      CONSTRAINT `fk_bugs_assigned_to_profiles_userid` FOREIGN KEY (`assigned_to`) REFERENCES `profiles` (`userid`) ON UPDATE CASCADE,
      CONSTRAINT `fk_bugs_component_id_components_id` FOREIGN KEY (`component_id`) REFERENCES `components` (`id`) ON UPDATE CASCADE,
      CONSTRAINT `fk_bugs_product_id_products_id` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON UPDATE CASCADE,
      CONSTRAINT `fk_bugs_qa_contact_profiles_userid` FOREIGN KEY (`qa_contact`) REFERENCES `profiles` (`userid`) ON UPDATE CASCADE,
      CONSTRAINT `fk_bugs_reporter_profiles_userid` FOREIGN KEY (`reporter`) REFERENCES `profiles` (`userid`) ON UPDATE CASCADE
    ) ENGINE=InnoDB AUTO_INCREMENT=4570 DEFAULT CHARSET=utf8;Edited by: Sky13 on Dec 22, 2011 1:36 PM

  • Pl help,i need to validate the data in UI with my database-mysql

    Hello All,
    pl help.
    i'm a newbie with jdbc and mysql
    i'll tell my requirment -i need to check whether the email id in the UI matches with the email id in the db,if the email id exists,i need to find its eid(eid is t priamary key,auto_increment),i've set my email id to be unique key...
    so if the email id matches with the email id in the db,i should get the eid,other wise ,need to insert the email id in the user_table...pl help me with the code.i'm working using exadel and java...need t code 2 do this in java
    pl..pl

    The user comes to the UI and enters the email address and he hits on submit button .... (if i am right)
    it is a simple task of passing the value from jsp to action class and do those operation.
    Can u provide the code that u have wriiten... so that i can help u !!!!

Maybe you are looking for