mysql

isValid() call never returns on MySQL JDBC Connection

Hi, I have trying to check whether connection is valid or not and using isValid() method of java.sql.Connection. But this method doesn't return and hangs. Is there anything I am missing or this method requires any configuration? Using mysql-connector-java-5.0.7-bin.jar Thanks, Shahid ...

MySQL not using index with JOIN, WHERE and ORDER

We have two tables resembling a simple tag-record structure as follows (in reality it's much more complex but this is the essance of the problem): tag (A.a) | recordId (A.b) 1 | 1 2 | 1 2 | 2 3 | 2 .... and recordId (B.b) | recordData (B.c) 1 | 123 2 | 666 3 | 124...

Retrieve last (latest) distinct highest value

I want to retrieve the most recent requestid from table tblquoteproposal` for perticular customerId here 3, in this example ID 2 & ID 4. table tblrequest requestid Customerid 6 2 7 4 8 3 9 3 Table tblquoteproposal id requestid QuotePraposalLink comment 1 6 ...

jdbc program to find the square of a number using callable statement (stored procedure )

import java .sql.*; class Pro { public static void main(String args[]) throws Exception { Class.forName("com.mysql.jdbc.Driver"); String url = "jdbc:mysql://localhost:3306/test"; Connection conn = DriverManager.getConnection (url,"root","password"); CallableStatement cst=conn.prepareCall("{call fileproc(?,?)}"); cst.setInt(1,10); cst.reg...

Am I doing Doctrine subclasses correctly? Why the Error?

I started to build a POS system in Doctrine. I am getting an order, but I have no clue whether or not I even set up subclasses in the proper way for Doctrine. Here is the model I came up with for line items on an order lineItem: line_total, order_id, type rentLineItem: returned_date_time, item_id, sold buyLineItem: item_id The databa...

SQL query result in a string (or variable)

Is it possible to output SQL query result in one string or variable? (i'm bad in php and mysql) Let's say I have db "agents" with columns - agent_id, agent_fname, agent_lname, agent_dept. Using this query: $sql = SELECT a.`agent_fname` FROM agents a WHERE a.`agent_dept` = 'FCA' I want to get a string or a variable, so I can use it in...

import mysql data to a table, edit/clone rows, and insert new rows

Is there already any software that will allow me to select a table or row from existing DB, edit that table, add new rows, or clone existing ones, then insert the new rows back into the DB? Read: i want to ADD this data, do not want to update/replace existing data. PHP5, and MySQL 5 ...

Converting table from MyISAM to INNODB

I am simply trying to convert a table from MyISAM to INNODB. This is for a bugzilla upgrade with testopia. This simple command fails. ALTER TABLE table_name TYPE = INNODB; ERROR 1214 (HY000): The used table type doesn't support FULLTEXT indexes I know it does not support FULLTEXT indexes, never the less I want it to convert. Would I h...

Designing mysql database tips & techniques, and some mysql questions?

Well, I am going to design a database structure, but I don't know where to start. Can you guys help me by answering the following questions? My database is going to store about hundreds of thousands rows/data and serving 1000 ++ users at the same time. It needs to be well designed. Design mysql database structure questions: Q1: I know ...

Debugging ErlyDB and MySQL

I am experimenting with ErlyDB in a non-erlyweb environment and I am not having much luck. I have a 'Thing' table for testing, and a corresponding Thing module: -module(thing). -export([table/0, fields/0]). table() -> thing. fields() -> [name, value]. The module itself works - I can query the database fine using ([Thing] = ...

Write MySQL output to file

I have a mysql query that runs in a php file that outputs a page of data. I need to somehow output that data to a file, to allow me to perform client side functions on that data as needed before exporting it for download. I need the temporary file named as a timestamp. Im wondering if i should use the fopen to create the file with the n...

Loading large mysql output into a variable to write to file

This is the code i have to write my file <? $date = date(F jS, Y g:i:s a); $filename = "$date.csv"; $fh = fopen($filename, 'w') or die("can't open file"); $data = ""; fwrite($fh, $data); fclose($fh); ?> The data that i need to write, consists of the output from a mysql query, shown here echo "<tr>"; echo "<td valign='top'>" . nl2br...

Mysql "order of operations" Question

Hi all, Here's my situation: I want to SELECT all entries from a database WHERE id = $id. But I want the results to be listed in a certain priority. If, criteria = $criteria, then I want those results displayed first. Otherwise, I just want to keep displaying the rest of the rows. My question is this: will this solve my problem?...

Find a specific column in an unknown table in a database?

I am trying to locate a specific column that is unknown in a database with 125 tables. I am looking for a wildcard, say, "%watcher%". Is this possible? ...

Sum the total value of a particular field in a mysql table using php and pulling the whole row in array form

Well the title sucks. But here is what I am trying to do. I have a foreach loop that is already pulling all the rows from a mysql db table using a db object style query in a function. That function is grabbing all fields and setting it up in an array ex foreach ($blahs as $blah => $blah_data) That now allows me to populate the page w...

what is the best method to translate strings to mysql dates?

What is the best way in php to take the following string mm[some char]dd[some char]yyyy and translate it to yyyymmdd? I will probably want in the future, according to local do the same with dd[some char]mm[some char]yyyy. If there is a way that already uses the Zend Framework API, the better ...

How do I get previous and next rows even though some rows have been deleted?

Hello all, I have the following PHP functions that determine the next and previous rows in a database. However, there are lots of occasions when rows can be deleted and therefore my functions will not work as all they do is decrement the auto_increment field. For example, current row 5. My function gives: 4 (previous) and 6 (next). Wha...

How do I remove a specific row result obtained through mysql_query?

I have a mysql_query result that I am looping through multiple times in different parts of code, each time using a mysql_data_seek( $result, 0 ) to reset to the beginning of the result. I am using mysql_fetch_array on those results, and would like to remove a few specific rows from the $result. Basically the equivalent to unset( $resul...

How can I determine the column type represented by a MySql .Net Connector's MySqlDateTime structure?

DataColumn.DataType returns FullName = "MySql.Data.Types.MySqlDateTime" regardless of the type of the column it represents, if it is either DATE, TIME, or DATETIME. Clearly I can query the information_schema.columns table, though I'm hoping that the connector library stores this detail somewhere that I just can't find in the documentati...

Open Source ChangeLog Options?

Are there any open source ChangeLog options? We would like to keep an in-house changelog so we can keep track of changes we do. Preferably, I'm looking for something PHP and MySQL as backend. Any suggestions? Thanks, Andrew ...