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? :-)

Similar Messages

  • Problem with BigInteger and MySql

    Hi !!
    I've a problem with BigInteger and MySql.
    I've a BigInteger object (suppose that value is 0.02270412445068359375).
    I must store that value in a database (MySql).
    The value of BigInteger object must be stored in a column of type Decimal.
    Stored value is 0.022704124450683594. Why ??
    My target is to store 0.02270412445068359375
    Can anyone help me?
    Thanks.

    Hi !!
    I've a problem with BigInteger and MySql.
    I've a BigInteger object (suppose that value is
    0.02270412445068359375).
    I must store that value in a database (MySql).
    The value of BigInteger object must be stored in a
    column of type Decimal.if this is the case I fear you are SOL. a decimal is the same size as a double but with a fixed max number of decimal places. if it isn't big enough then you have no real choice other than to VARCHAR it.
    Stored value is 0.022704124450683594. Why ??
    My target is to store 0.02270412445068359375
    Can anyone help me?
    Thanks.

  • Any problem with a single MySQL database used on more than one site?

    I have a set of multiple sites hosted separately I'm working on. I'd like to set up a PHP/MySQL database on one site, and be able to pull data from it for completely separate sites. Seems like it shouldn't be a problem. Are there any problems with doing this I need to be aware of?

    I've set up databases on three different hosts, and in all cases I could access the databases from outside the domain of the site itslef.  GoDaddy is one of them, they used to restrict it, but now they give you the option when setting up a new database on your account.

  • Problems with JSP and MySql bean.

    Hi,
    I'm new to JSP and I'm having some problems with it. I'm trying to do a simple login where a java class (bean?) handles the SQL injektion. I have deployed the page on tomcat and it works fine, except that the sqlinjektion does basically nothing. I have installed the mysql driver. I think there is something wrong with the java class, or the way im calling it. It does not produce any error. But its like it would never actually process the java code, because ive tried to append things to error string to see what is going on, nothing happens. everything stay null, no exceptions are thrown. If I implement the code to JSP itself, it does load the driver and print exception that there is no connection to database (which is correct). What am I missing? Code follows:
    the sqlhandler:
    public abstract class SqlInjektor {
         private static String Database = "*****";
         private static String serverName = "localhost:3306";
         private static String usrName="******";
         private static String passw="******";
         * @return Connection
         public static Connection createConnection(String error){
              Connection mySqlCon = null;
              try{
                   Class.forName("com.mysql.jdbc.Driver").newInstance();
              catch(Exception E){
                   PrintWriter out = response.getWriter();
                   out.println("lol");
              String url = "jdbc:mysql://" + serverName + "/" + Database + "?user=" + usrName + "&password=" + passw;
              try{
                   mySqlCon = DriverManager.getConnection(url);
              catch (Exception E){
                   E.printStackTrace(System.out);
              return mySqlCon;
         * Metodi saa sy�tteen��n SQL komennon, jonka se suorittaa sek� palauttaa komennon tulokset.
         * @param command
         * @return ResultSet
         public static ResultSet querySQL(String command,String error, Connection con){
              ResultSet rs = null;
              try{
                   Statement stmt = con.createStatement();
                   rs = stmt.executeQuery(command);
              catch(Exception E){
                   E.printStackTrace(System.out);
              return rs;
    the jsp page:
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <%@ page isErrorPage="false" %>
    <%@ page import="java.sql.*" %>
    <%@page import="ot3.User"%>
    <%@page import="ot3.SqlInjektor"%>
    <%@page import="Javax.servlet.jsp.*"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>vastaanotto</title>
    </head>
    <body>
    <%!      String id;
         String password;
         String error = new String("Error!\n");
         User user;
    %>
    <%      user = new User();
         session.putValue("currentUser",user);
         id = request.getParameter("authName");
    password = request.getParameter("Password");
         Connection conn=null;
         ResultSet rs=null;
         conn = SqlInjektor.createConnection(error);
         if(conn!=null){
              out.println("conn ok!");
              rs = SqlInjektor.querySQL("SELECT * FROM user WHERE id='" + id +"' AND password='" + password+"' COLLATE latin1_bin;",error,conn);}
         try {
              if (rs!= null && rs.next()){
                   user.setID(rs.getInt("id"));
                   user.setName(rs.getString("name"));
                   user.setPassword(rs.getString("password"));
                   user.setClearance(rs.getInt("clearance"));
                   if(rs.getString("addedby")!=null)
                        user.setAdder(rs.getInt("addedby"));
                   if(rs.getString("lastmodifier")!=null)
                        user.setModifier(rs.getInt("lastmodifier"));
                   rs.close();%>
                   ONNISTU!
              <%}
              else {
                   out.println(error);     
         } catch (SQLException e) {
              out.println(e.getMessage());
         }%>
    </body>
    </html>

    Hi,
    I'm new to JSP and I'm having some problems with it. I'm trying to do a simple login where a java class (bean?) handles the SQL injektion. I have deployed the page on tomcat and it works fine, except that the sqlinjektion does basically nothing. I have installed the mysql driver. I think there is something wrong with the java class, or the way im calling it. It does not produce any error. But its like it would never actually process the java code, because ive tried to append things to error string to see what is going on, nothing happens. everything stay null, no exceptions are thrown. If I implement the code to JSP itself, it does load the driver and print exception that there is no connection to database (which is correct). What am I missing? Code follows:
    the sqlhandler:
    public abstract class SqlInjektor {
         private static String Database = "*****";
         private static String serverName = "localhost:3306";
         private static String usrName="******";
         private static String passw="******";
         * @return Connection
         public static Connection createConnection(String error){
              Connection mySqlCon = null;
              try{
                   Class.forName("com.mysql.jdbc.Driver").newInstance();
              catch(Exception E){
                   PrintWriter out = response.getWriter();
                   out.println("lol");
              String url = "jdbc:mysql://" + serverName + "/" + Database + "?user=" + usrName + "&password=" + passw;
              try{
                   mySqlCon = DriverManager.getConnection(url);
              catch (Exception E){
                   E.printStackTrace(System.out);
              return mySqlCon;
         * Metodi saa sy�tteen��n SQL komennon, jonka se suorittaa sek� palauttaa komennon tulokset.
         * @param command
         * @return ResultSet
         public static ResultSet querySQL(String command,String error, Connection con){
              ResultSet rs = null;
              try{
                   Statement stmt = con.createStatement();
                   rs = stmt.executeQuery(command);
              catch(Exception E){
                   E.printStackTrace(System.out);
              return rs;
    the jsp page:
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <%@ page isErrorPage="false" %>
    <%@ page import="java.sql.*" %>
    <%@page import="ot3.User"%>
    <%@page import="ot3.SqlInjektor"%>
    <%@page import="Javax.servlet.jsp.*"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>vastaanotto</title>
    </head>
    <body>
    <%!      String id;
         String password;
         String error = new String("Error!\n");
         User user;
    %>
    <%      user = new User();
         session.putValue("currentUser",user);
         id = request.getParameter("authName");
    password = request.getParameter("Password");
         Connection conn=null;
         ResultSet rs=null;
         conn = SqlInjektor.createConnection(error);
         if(conn!=null){
              out.println("conn ok!");
              rs = SqlInjektor.querySQL("SELECT * FROM user WHERE id='" + id +"' AND password='" + password+"' COLLATE latin1_bin;",error,conn);}
         try {
              if (rs!= null && rs.next()){
                   user.setID(rs.getInt("id"));
                   user.setName(rs.getString("name"));
                   user.setPassword(rs.getString("password"));
                   user.setClearance(rs.getInt("clearance"));
                   if(rs.getString("addedby")!=null)
                        user.setAdder(rs.getInt("addedby"));
                   if(rs.getString("lastmodifier")!=null)
                        user.setModifier(rs.getInt("lastmodifier"));
                   rs.close();%>
                   ONNISTU!
              <%}
              else {
                   out.println(error);     
         } catch (SQLException e) {
              out.println(e.getMessage());
         }%>
    </body>
    </html>

  • Problems with Apache PHP Mysql

    I tried doing an upgrade from Tiger to Leopard server but was having lots of issues while working with the virtual sites I have hosted. I tried a clean install and I was still unable to get Apache php and mysql to work together. Each service was starting fine but when I would try to run a php file it would only display a white page. Under the upgrade instead of displaying the page it was downloading any page I tried to load.
    In the new clean install I enabled phplib5 through server admin but even a simple info.php file with <?php phpinfo(); ?> was only giving me a white page. I dont know if mysql was interfacing with php and apache at this point cause I could not get any further. I mainly just want to be able to run wordpress which is a php blog that uses a mysql database.
    I have heard some people talking about mamp installs and not using the stock web services but I did not know if that would be a smart route to take.

    well the problem come in that you could end out with multiple releases of the same application when the idea is to make one package "stable"
    would you rather have a debain package data base that has seventeen apache's or one stable full featured apache?
    as for a server/stable tree for production machines this is coming. implimentation is not the trouble it is time that is a factor.

  • Problems with PreparedStatement and MySQL selecting bytes

    Hi,
    i have a problem trying to select information when the "select" has a byte restrict.
    The table in database is:
    CREATE TABLE `positions` (
    `PKID` int(10) unsigned NOT NULL auto_increment,
    `POSCODE` varbinary(30) NOT NULL,
    `ISWTURN` binary(1) NOT NULL,
    `QTT_GAMES` int(10) unsigned NOT NULL default '1',
    PRIMARY KEY (`PKID`),
    UNIQUE KEY `UNIQ_POS` (`POSCODE`,`ISWTURN`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    And the test code to get the qtt_games is :
    conn = DriverManager.getConnection (url,user,pwd);
    byte bcode[] = poscode.getByteArrayCode();
    // bcode is inserted ok in another preparedstatement...
    String query = "SELECT qtt_games FROM positions "+
         "WHERE poscode=? and iswturn=?";
    PreparedStatement pstmt = conn.prepareStatement(query);
    pstmt.setBytes (1,bcode);
    pstmt.setByte (2,poscode.getIsWhiteTurn()); //it returns a byte
    ResultSet rs = pstmt.executeQuery (query);
    When pstmt.executeQuery is reached, it's thrown the exception:
    com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: 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 '=? and iswturn=?' at line 1
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:3170)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:3099)
    at com.mysql.jdbc.Statement.execute(Statement.java:695)
    at app.server.bbdd.MYSQLBDManager.getGamesBasicInfo(MYSQLBDManager.java:942)
    at app.server.bbdd.MYSQLBDManager.main(MYSQLBDManager.java:1068)
    Can anybody tell me what's wrong?? I think the query is ok, but don't know what's happening with this...
    Lots of thanks.

    Don't cross-post, it's considered rude:
    http://forum.java.sun.com/thread.jspa?threadID=5122604&messageID=9430056#9430056
    http://forum.java.sun.com/thread.jspa?threadID=5122603&messageID=9430050#9430050
    One to a customer, please.
    %

  • Custom mySQL  - updating path / problem with pre-installed mySQL

    I've got a custom mySQL installation setup and humming along on a 10.6.4 server. The problem is although I've updated the paths to search on usr/local/mysql/bin, when I try to access by using the shortcut mysql i get this error: Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' . To be clear, mySQL is working fine - it's just the shortcut that's not.
    This makes me think that the shell is looking first at the default [not enabled] apple mysql install. So something in my paths must be wiggy.
    I had this working perfectly on my 10.4 Xserve but the no one, I'm at a loss.
    Has anyone else run into this - any tips? I'm not going to be running the Apple install of mySQL.

    Actually, my problem is not with the socket location but with the data directory location. But I think is caused by the same path problem to data as yours was with socket. I have posted this question to the Mac OS X Technologies > Unix forum. If you could take a look, I would appreciate it.
    Thanks.

  • Problems with PHP and MySQLi server behaviors

    Hi,
    I'm a graphic and Web-designer with some knowledge of PHP and MySQL and I've been using Dreaweaver since very early ages in creating dynamic web projects and use the Bindings and Server behaviors quite a lot. But recently PHP has deprecated MySQL_connect since 2012 and it seems Dreamweaver isnt suporting the alternative MYSQLi server behaviors which will be the future of accessing Databases in MySQL along side with other options. Without this feature Dreamweaver is not of any use to us web-designers, since there are many Free great Editing software out there... Is the Dreamweaver team solving this problem? Or are you really planning on dropping this software? I've been using CS5.5 for a while and was planning on updating but this is a key feature and without it its not worth the investment.
    Kind regards.
    Eddy

    heduino wrote:
    Hi,
    I'm a graphic and Web-designer with some knowledge of PHP and MySQL and I've been using Dreaweaver since very early ages in creating dynamic web projects and use the Bindings and Server behaviors quite a lot. But recently PHP has deprecated MySQL_connect since 2012 and it seems Dreamweaver isnt suporting the alternative MYSQLi server behaviors which will be the future of accessing Databases in MySQL along side with other options. Without this feature Dreamweaver is not of any use to us web-designers, since there are many Free great Editing software out there... Is the Dreamweaver team solving this problem? Or are you really planning on dropping this software? I've been using CS5.5 for a while and was planning on updating but this is a key feature and without it its not worth the investment.
    Kind regards.
    Eddy
    There are no plans that I know of to introduce a new set of mysqli server behaviours into DW from Adobe. They have left that to  thrid party developers to bring out extensions which replace them.
    What the server behaviours could do was very limiting anyway so I suspect any replacement mysqli behaviours would also be very limiting. I personally jumped into thre code and started to write my own mysqli connection files and query strings by watching a few simple tutorials on youtube - it isnt that difficult.
    Look for 'php academy' on youtube - they have about 9 simple to follow tutorials on getting started with mysqli.

  • Problem with connection in Mysql database in struts application

    Helllo
    i've just started learning struts for my new project where i'm having problem in accessing mysql database
    the datasource being defined in struts-config.xml is as follows:
    <data-sources >
        <data-source type="org.apache.tomcat.dbcp.dbcp.BasicDataSource">
          <set-property property="driverClassName" value="com.mysql.jdbc.Driver" />
          <set-property property="user" value="root" />
          <set-property property="password" value="" />
          <set-property property="minCount" value="" />
          <set-property property="maxCount" value="" />
          <set-property property="description" value="A" />
          <set-property property="url" value="jdbc:mysql:///dnbotind_nbotdb" />
          <set-property property="readOnly" value="false" />
          <set-property property="autoCommit" value="true" />
          <set-property property="loginTimeout" value="" />
        </data-source>
      </data-sources>as i run the application
    it gives the errors HTTP status 404-Servlet action is not available
    Thx in advance

    student-java wrote:
    it gives the errors HTTP status 404-Servlet action is not availableThis is unrelated to the datasource configuration.
    HTTP 404 is a "Page not found" error. The request URL is simply wrong. Either there's a typo in the URL, or there is a typo in the servlet mapping, or the servlet is not there where you think.

  • [JAVA] problems with java and mysql

    Hi, i have already installed php + mysql and work's them fine, but i want to install java + mysql. I have downloaded eclipse and installed its, that's ok. I have download tomcat and, that's ok. I have download module jconnector and have copied the file .jar in the java home and set classpath. Run and compiled this source that's ok. At runtime the program ask: Impossible connection at the database, why ? It's the source of program:
    [JAVA]
    import java.sql.*;
    public class connessione {
    private String nomeDB; // Nome del Database a cui connettersi
    private String nomeUtente; // Nome utente utilizzato per la connessione al Database
    private String pwdUtente; // Password usata per la connessione al Database
    private String errore; // Raccoglie informazioni riguardo l'ultima eccezione sollevata
    private Connection db; // La connessione col Database
    private boolean connesso; // Flag che indica se la connessione � attiva o meno
    public connessione(String nomeDB) { this(nomeDB, "", ""); }
    public connessione(String nomeDB, String nomeUtente, String pwdUtente) {
    this.nomeDB = nomeDB;
    this.nomeUtente = nomeUtente;
    this.pwdUtente = pwdUtente;
    connesso = false;
    errore = "";
    // Apre la connessione con il Database
    public boolean connetti() {
    connesso = false;
    try {
    // Carico il driver JDBC per la connessione con il database MySQL
    Class.forName("com.mysql.jdbc.Driver");
    // Controllo che il nome del Database non sia nulla
    if (!nomeDB.equals("")) {
    // Controllo se il nome utente va usato o meno per la connessione
    if (nomeUtente.equals("")) {
    // La connessione non richiede nome utente e password
    db = DriverManager.getConnection("jdbc:mysql://localhost/" + nomeDB);
    } else {
    // La connessione richiede nome utente, controllo se necessita anche della password
    if (pwdUtente.equals("")) {
    // La connessione non necessita di password
    db = DriverManager.getConnection("jdbc:mysql://localhost/" + nomeDB + "?user=" + nomeUtente);
    } else {
    // La connessione necessita della password
    db = DriverManager.getConnection("jdbc:mysql://localhost/" + nomeDB + "?user=" + nomeUtente + "&password=" + pwdUtente);
    // La connessione � avvenuta con successo
    connesso = true;
    } else {
    System.out.println("Manca il nome del database!!");
    System.out.println("Scrivere il nome del database da utilizzare all'interno del file \"config.xml\"");
    System.exit(0);
    } catch (Exception e) { errore = e.getMessage(); }
    return connesso;
    public static void main(String [] args) {
    connessione a=new connessione("asta","root","");
    if(a.connetti())
    System.out.println("Connessione al database riuscita");
    else
    System.out.println("Connessione al database non riuscita");
    [JAVA]

    With this line I always pass the username and password also:
    db = DriverManager.getConnection("jdbc:mysql://localhost/" + nomeDB);
    db = DriverManager.getConnection("jdbc:mysql://localhost/" + nomeDB, useName, Password);
    Make sure you create your users in MySQL with the correct permissions

  • Problems with java and mysql error: 1064

    Hello,
    I have been struggling with the following java code for a day. I ALWAYS get the following error code : 1064 and I just can't figure out why. I am trying to insert data into a mysql table.
    Can anyone please help?
    Thanks in advance,
    Julien.
    package com.newedgegroup.pnr.misc;
    import java.sql.BatchUpdateException;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.text.ParseException;
    import java.text.SimpleDateFormat;
    * @author Julien Martin
    public class RunDataCopy {
        public static void main(String[] args) throws ClassNotFoundException, Exception , ParseException {
            Class.forName("com.ibm.as400.access.AS400JDBCDriver");
            String url_source = "jdbc:as400://as400a.calyonfinancial.com";
            Connection con_source = DriverManager.getConnection(url_source, "upload", "upload");
            Class.forName("com.mysql.jdbc.Driver");
            String url_target = "jdbc:mysql://localhost:3306/pnr";
            Connection con_target = DriverManager.getConnection(url_target, "root", "");
            Statement stat_source = con_source.createStatement();
    //        ResultSet rs_source = stat_source.executeQuery("select * from QS36F.GMIST4F1 po");
            String query = "SELECT " +
                    " sum (po.PGROSS) AS OPTION_PREMIUM, " +
                    "po.PFIRM, " +
                    "po.POFFIC, " +
                    "po.PACCT, " +
                    "po.PTDATE, " +
                    "po.PRR, " +
                    "po.PEXCH, " +
                    "po.PSUBEX, " +
                    "po.PFC, " +
                    "po.PSYMBL, " +
                    "po.PCLASS, " +
                    "po.PSUBCL, " +
                    "po.PSUBTY, " +
                    "po.PSDSC1, " +
                    "po.PCTYM, " +
                    "po.PSTRIK, " +
                    "po.PCLOSE, " +
                    "po.PUNDCP, " +
                    "po.PCURSY, " +
                    "po.PEXPDT, " +
                    "po.PLTDAT, " +
                    "po.PMULTF, " +
                    "po.PPTYPE, " +
                    "po.PBS " +
                    "FROM QS36F.GMIST4F1 as po " +
                    "WHERE " +
                    "0              = 0 " +
                    "AND po.PFIRM   = 'I' " +
                    "AND po.POFFIC  = '349' " +
                    "AND po.PRECID in ('T','B','Q') " +
                    "AND po.PSUBTY != ' ' " +
                    "AND po.PCMNT1 != ' E' " +
                    "AND po.PCMNT1 != ' A' " +
                    "GROUP BY " +
                    "po.PFIRM, " +
                    "po.POFFIC, " +
                    "po.PACCT, " +
                    "po.PTDATE," +
                    "po.PRR, " +
                    "po.PEXCH, " +
                    "po.PSUBEX," +
                    "po.PFC, " +
                    "po.PSYMBL, " +
                    "po.PCLASS, " +
                    "po.PSUBCL, " +
                    "po.PSUBTY, " +
                    "po.PSDSC1, " +
                    "po.PCTYM, " +
                    "po.PSTRIK, " +
                    "po.PCLOSE, " +
                    "po.PUNDCP, " +
                    "po.PCURSY, " +
                    "po.PEXPDT, " +
                    "po.PLTDAT, " +
                    "po.PMULTF, " +
                    "po.PPTYPE, " +
                    "po.PBS ";
            // System.out.println(query);
            ResultSet rss = stat_source.executeQuery(query);
            StringBuffer sb = new StringBuffer("");
            SimpleDateFormat df_s = new SimpleDateFormat("yyyyMMdd");
            SimpleDateFormat df_t = new SimpleDateFormat("yyyy-MM-dd");
            con_target.setAutoCommit(false);
            Statement stat_target = con_target.createStatement();
            int i = 0;
            try {
                while (rss.next()) {
                    i++;
                    sb.append("INSERT INTO `pnr`.`pnr_transaction` (").append("\n");
                    sb.append("`FIRM_ID`,").append("\n");
                    sb.append("`OFFICE_NUMBER`,").append("\n");
                    sb.append("`ACCOUNT_NUMBER`,").append("\n");
                    sb.append("`SALESMAN`,").append("\n");
                    sb.append("`EXCHANGE_CODE`,").append("\n");
                    sb.append("`SUBEXCHANGE`,").append("\n");
                    sb.append("`FUTURES_CODE`,").append("\n");
                    sb.append("`SYMBOL`,").append("\n");
                    sb.append("`ACCOUNT_CLASS_CODE`,").append("\n");
                    sb.append("`SUB_CLASS_CODE`,").append("\n");
                    sb.append("`SECURITY_SUB_TYPE`,").append("\n");
                    sb.append("`SECURITY_DESCRIPTION_LINE`,").append("\n");
                    sb.append("`CONTRACT_YR_MON`,").append("\n");
                    sb.append("`STRIKE_PRICE`,").append("\n");
                    sb.append("`CLOSING_MARKET_SETTLEMENT_PRICE`,").append("\n");
                    sb.append("`UNDERLYING_CLOSE_PRICE`,").append("\n");
                    sb.append("`PRODUCT_CURRENCY_SYMBOL`,").append("\n");
                    sb.append("`EXPIRATION_DATE`,").append("\n");
                    sb.append("`LAST_TRADING_DATE`,").append("\n");
                    sb.append("`MULTIPLICATION_FACTOR`,").append("\n");
                    sb.append("`PRODUCT_TYPE_CODE`,").append("\n");
                    sb.append("`CATEGORY_ID`,").append("\n");
                    sb.append("`MARKET_TYPE_ID`,").append("\n");
                    sb.append("`TAX_STATUS_ID`,").append("\n");
                    sb.append("`AMOUNT`").append("\n");
                    sb.append(") VALUES (").append("\n");
                    sb.append("'").append(rss.getString("PFIRM")).append("'").append(",").append("\n");
                    sb.append("'").append(rss.getString("POFFIC")).append("'").append(",").append("\n");
                    sb.append("'").append(rss.getString("PACCT")).append("'").append(",").append("\n");
                    sb.append("'").append(rss.getString("PRR")).append("'").append(",").append("\n");
                    sb.append("'").append(rss.getString("PEXCH")).append("'").append(",").append("\n");
                    sb.append("'").append(rss.getString("PSUBEX")).append("'").append(",").append("\n");
                    sb.append("'").append(rss.getString("PFC")).append("'").append(",").append("\n");
                    sb.append("'").append(rss.getString("PSYMBL")).append("'").append(",").append("\n");
                    sb.append("'").append(rss.getString("PCLASS")).append("'").append(",").append("\n");
                    sb.append("'").append(rss.getString("PSUBCL")).append("'").append(",").append("\n");
                    sb.append("'").append(rss.getString("PSUBTY")).append("'").append(",").append("\n");
                    sb.append("'").append(rss.getString("PSDSC1")).append("'").append(",").append("\n");
                    sb.append("'").append(rss.getString("PCTYM")).append("'").append(",").append("\n");
                    sb.append(rss.getString("PSTRIK")).append(",").append("\n");
                    sb.append(rss.getString("PCLOSE")).append(",").append("\n");
                    sb.append(rss.getString("PUNDCP")).append(",").append("\n");
                    sb.append("'").append(rss.getString("PCURSY")).append("'").append(",").append("\n");
                    sb.append("'").append(df_t.format(df_s.parse(rss.getString("PEXPDT")))).append("'").append(",").append("\n");
                    sb.append("'").append(df_t.format(df_s.parse(rss.getString("PLTDAT")))).append("'").append(",").append("\n");
                    sb.append(rss.getString("PMULTF")).append(",").append("\n");
                    sb.append("'").append(rss.getString("PPTYPE")).append("'").append(",").append("\n");
                    //sb.append(rss.getString("PBS")).append(",");
                    sb.append("1").append(",").append("\n");
                    sb.append("1").append(",").append("\n");
                    sb.append("1").append(",").append("\n");
                    sb.append(rss.getString("OPTION_PREMIUM")).append("").append("\n");
                    // sb.append(df_t.format(df_s.parse(rss.getString("PTDATE")))).append(",");
                    sb.append(") ").append("\n");
                    System.out.println(sb.toString());
                    //     stat_target.executeUpdate(sb.toString());
                    stat_target.addBatch(sb.toString());
    //        stat_target.executeUpdate(sb.toString());
                    if (i == 2) {
                        break;
                stat_target.executeBatch();
                con_target.commit();
            } catch (BatchUpdateException be) {
                System.out.println("be: "+be.getErrorCode());
                System.out.println("be: "+be.getMessage());
                be.printStackTrace();
                System.out.println("be: "+i);
            } catch (SQLException se) {
                System.out.println("se: "+se.getErrorCode());
                System.out.println("se: "+i);
    }

    What is the error message?
    I advice you to use prepared statement for batch inserting.

  • Problems with ACS4 and MySQL Server

    Hi,
    I am using acs4 with MySQL Server 5.0.67 as database under Windows. It all works fine except that very often I get a deadlock exception using the admin console.
    Here is what is logged in the admin.log:
    23 Apr 2009 12:20:15,231 TRACE DefaultSQLDatabaseRecordEnumerator: SELECT resourceid, voucherid, encryptionkey, permissions, defaultitem FROM resourcekey WHERE resourceid = ?
    23 Apr 2009 12:20:15,231 TRACE DefaultSQLDatabaseRecordEnumerator:   obj 1 = acc14cde-ea85-4f29-82ef-a771438bbcfc
    23 Apr 2009 12:20:15,262 ERROR DefaultSQLDatabaseConnection: com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction
    23 Apr 2009 12:20:15,262 TRACE DefaultSQLDatabaseConnection: rollback
    23 Apr 2009 12:20:15,262 ERROR AdeptServlet: database error [192.168.2.101]
    com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
        at com.mysql.jdbc.Util.getInstance(Util.java:381)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1045)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3515)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3447)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1951)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2101)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2554)
        at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1761)
        at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2046)
        at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1964)
        at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1949)
        at com.adobe.adept.persist.DefaultSQLDatabaseConnection.deleteExpired(DefaultSQLDatabaseConn ection.java:479)
        at com.adobe.adept.shared.security.DistributorNonceUtil.checkNonce(DistributorNonceUtil.java :56)
        at com.adobe.adept.admin.servlet.ManagePersistent.doPost(ManagePersistent.java:291)
        at com.adobe.adept.admin.servlet.ManagePersistent.doPost(ManagePersistent.java:40)
        at com.adobe.adept.servlet.AdeptServlet.doPost(AdeptServlet.java:184)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j ava:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.ja va:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Unknown Source)
    23 Apr 2009 12:20:15,278 TRACE AdeptServlet: request end http://...
    MySql is using InnoDB as storage engine.

    yes, you can do this via the admin gui by modifying the http listener port.
    You can also do this via the cli commandline as well http-listener-1 is the one you want to change the port for.
    http://docs.sun.com/source/817-6088/httpservice.html has details

  • Problems with connecting to mySQL

    Hi,
    I'm using JSP for web development and I want to use mySQL as my database.
    My problem is:
    When trying to create a new instant
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    I get the following exception:
    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    Please note that I'm using NetBeans as my IDE. The IDE itself successfully connects to mySQL and gets the schema.
    Anybody helps?

    I get below error on excecuting the code.
    com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.io.EOFException STACKTRACE: java.io.EOFException at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1913) at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:501) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:971) at com.mysql.jdbc.Connection.createNewIO(Connection.java:2644) at com.mysql.jdbc.Connection.(Connection.java:1531) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266) at java.sql.DriverManager.getConnection(DriverManager.java:512) at java.sql.DriverManager.getConnection(DriverManager.java:171) at org.apache.jsp.tracker_jsp._jspService(tracker_jsp.java:59) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683) at java.lang.Thread.run(Thread.java:534) ** END NESTED EXCEPTION ** Last packet sent to the server was 0 ms ago.
    Please let me know how to resolve the same.

  • Performance problems with JDBC and mysql

    Hi,
    I have here a "one table" database which has 1.000.000 data rows. The problem is, that deleting a special entry (ie delete from mytable where da_value="foo1") takes between 10 and 60 seconds.
    Does anyone can help me out of this performance trap.
    LoCal

    table indexed and keys used?
    always preferred postgres! :)

  • Problems with connecting my Mysql db to visual studio 2013

    Hey all,
    I tried connecting my MYSQL db to my visual studio 2013
    after installing all db connectors from MYSQL and tried following multiple guides its still not working.
    I first had VS Express but it seems the express versions don't support that so then i went to get a VS Professional 2013 (trial i think) and this didn't work either. 
    Does anyone know any solution other than installing connectors (reinstalled them like 2 times already) or getting another VS ?
    Thanks in advance 

    Hi Weffke,
    The forum supports VS setup and installation. And I think your issue isn't related to the forum.
    >>after installing all db connectors from MYSQL and tried following multiple guides its still not working.
    I think your issue is more about MYSQL. So I suggest you post your issue to the related forum below.
    http://forums.mysql.com/list.php?174
    I will move the thread to off-topic forum. Thanks for your understanding.
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for

  • How to use csv file to populate all the items in a form

    Our environment - Forms 6i/IAS 9i on Solaris/8.1.6 database on Solaris. In the web form I want the user to type in the name of an existing csv file(which contains 1 record). Then press a button and all the items on the form should be populated with t

  • Some sites do not display images, eg ebay and link from Trek bike

    the images on ebay will not load when selecting an item. Trek bike"dream giveaway contest" sit does not display "game" image. Just installed new Hard drive Mac OD 10.4.1 == URL of affected sites == http://

  • Table pop-ups don't work in iWork Pages, any ideas?

    Pop ups in Numbers tables work when transferred to Pages on the Mac but don't appear to work in iWork pages On the iphone and iPad. I produce approximately 20 reports a week in Pages. Not sure if I'm missing something, or this feature just doesn't ex

  • Launch application like "word"

    Hello all, I have build an intranet with resin2.0.16 and JDK1.3. And in this intranet i want to launch application on client PC. I can run any application for the moment but only in the web server. Is it possible to run application on the client pc ?

  • Decimal Places in Arabic Currency

    Hi, I have created an ADOBE FORM to display some currency values. Before display I am converting it to Arabic from within the program. When I do that the currency decimal notation is getting disturbed e.g. it is displayed like this ٢٥٬٠٠٠ If you see