Similar to mysql's store_result

Hi there
I'm selecting a table with 300.000 rows.
calling: ResultSet->Next() is getting one row at the time, and over
the Internet that is very slow.
On mySQL there is a function named mysql_store_result, which gets all the
select data in one chunk into memory, and then I can process one row at the time, without making a fetch over the net every time (300.000 times!).
How to do that on Oracle ??
thanx in advance.

Haha, yes, good question!
The thing is, when we are during developent then our 'work machines' are 'far away' from the database-server, so that makes development really slow when fetching many rows.
In production the application and database is on same lan, so there would be no problem.
thanx anyway

Similar Messages

  • How to store images in BLOB field in MySql database using java

    Hi....
    Currently am able to store character string into BLOB using byte array....in MySql.
    but i cannot store images or pictures.......
    to do this.........please help me out...............
    Thanx..........:)Bye...........

    Hello,
    I have done this for Oracle but it should be similar in MySQL also. Try reading thru these links below. Mail us if you have succeeded or not.
    http://forum.java.sun.com/thread.jspa?forumID=48&threadID=654086
    http://forum.java.sun.com/thread.jspa?forumID=48&threadID=384768
    http://forum.java.sun.com/thread.jspa?forumID=48&threadID=549705
    Thanks and regards,
    Pazhanikanthan. P

  • Php4 with mysql

    I need to get this to work..... php4.3.10 with mysql...
    tried about every single PKGbuild i could find, but every single one
    of them dont give me support for mysql... Meaning trying to use phpmyadmin i get mysql module not loaded ... I have used this pkgbuild in which you can see i do use the --with mysql flag/option... can some one plz help me out here or tell me where i go wrong or what i have to do to make it work ???? plz ....
    pkgname=php
    pkgver=4.3.10
    pkgrel=2
    pkgdesc="A high-level scripting language"
    backup=(etc/php.ini)
    depends=('openssl' 'libjpeg' 'freetype2' 'libpng' 'pam' 
             'gdbm' 'libxslt' 'openldap')
    makedepends=('apache' 'mysql' 'bzip2' 'smtp-server')
    source=(http://www.php.net/distributions/$pkgname-$pkgver.tar.gz php.ini)
    url="http://www.php.net"
    build() {
      cd $startdir/src/$pkgname-$pkgver
      ./configure --with-apxs2 --prefix=/usr --sysconfdir=/etc 
        --with-ttf --enable-mailparse --with-config-file-scan-dir=/etc 
        --enable-bcmath=shared --enable-calendar=shared --enable-ftp=shared 
        --enable-gd-native-ttf --enable-magic-quotes --enable-posix=shared 
        --enable-session --enable-shared --enable-shmop=shared 
        --enable-sysvsem=shared --enable-sysvshm=shared --enable-track-vars 
        --enable-trans-sid --enable-safe-mode --enable-sockets=shared 
        --enable-xml --with-bz2=shared --without-db2 --without-db3 
        --with-freetype-dir=/usr --with-gd --with-gdbm --enable-exif 
        --with-jpeg-dir=/usr --with-mysql=shared,/usr --with-ldap 
        --with-mysql-sock=/tmp/mysql.sock --with-openssl --with-gettext 
        --with-pear=/usr/share/pear --with-dom --with-dom-xslt 
        --with-png-dir=/usr --with-regex=php --with-zlib --with-curl
      make || return 1
      mkdir -p $startdir/pkg/usr/lib/apache
    #  cp config_vars.mk config_vars.old
    #  sed "s|^INSTALL_IT.*$|INSTALL_IT = apxs -i -a -S LIBEXECDIR=$startdir/pkg/usr/lib/apache -n php4 libs/libphp4.so|" config_vars.old >config_vars.mk
      sed -i "s|-i -a -n php4|-i -n php4|g" Makefile
      make INSTALL_ROOT=$startdir/pkg EXTENSION_DIR=/usr/lib/php install
      cp ../php.ini $startdir/pkg/etc

    exactly. build php. install the package.
    find out what the name of the mysql extension is..
    ls -lR /usr/lib/php/extensions | grep -i 'sql'
    look for the one that is similar to mysql.so or something..
    then edit php.ini, and add
    extension=mysql.so
    if might already be in there...just uncomment it if it is.
    then restart apache.

  • How to go around max path lenght in Solaris

    Hi, I have really special question. I have been searching internet for answers, but nothnig satisfy my needs.
    I found some basic info in http://forums.sun.com/thread.jspa?threadID=5357258
    I need to store realy huge amount of files and i have been searchnig for suitable FS. I have found ZFS wich is ideal for my needs. My problem is, that file path is limited to 1024 chars. Please don't say, that is long enough, i need more. This limitation is "guaranteed limit for the length of a path that system calls will deal with" so is it possible to raise this number or somehow to go around it?? I wrote test programs in Java nad C++ and both stops creating dirs when file path was about 1024.
    For example in Windows is path limit 260 chars, but it is only backward compatibility, so using Win API it is possible to have path length about 32 000. Exists something similar in solaris?
    And next question is about ZFS. It is better to have huge amount of files in dir tree or all files in one dir (if it is not limited like file path)? For human is better dirs, i know, but my files wont be human-browsable.
    dir tree:        in one dir:
    /0/0.ext         /00.ext
    /0/0/0.ext       /000.ext
    /0/0/0/0.ext     /0000.ext
    /0/0/0/1.ext     /0001.extwich type of storage has better efficiency in ZFS?
    Thanks

    I have made some tests and here are results:
    OS: OpenSolaris 2009.06 (console mode, not Gnome)
    FS: ZFS
    CPU: Intel Pentium 4
    RAM: 1 GB (free 500 MB before start)
    Test 1 - ZFS
    Files: about 220,000 (system) + 12,356,630 (generated and tested files)
    File size: 1024 B
    Generation speed: about 1200 files per second
    Deleting speed: 10 hours
    +-----+---------+--------+--------+-------------+
    |found|  files  |  time  |  avrg  | readed data |
    +-----+---------+--------+--------+-------------+
    | yes |   1,024 | 45 sec |  44 ms |       1 MiB |
    | yes |   1,024 | 37 sec |  36 ms |       1 MiB |
    | yes |   1,024 | 50 sec |  49 ms |       1 MiB |
    | yes |   1,024 | 42 sec |  41 ms |       1 MiB |
    | yes |   1,024 | 36 sec |  35 ms |       1 MiB |
    | yes |   1,024 | 48 sec |  47 ms |       1 MiB |
    | yes |   1,024 | 40 sec |  39 ms |       1 MiB |
    | yes |   1,024 | 36 sec |  35 ms |       1 MiB |
    | yes |   1,024 | 51 sec |  50 ms |       1 MiB |
    | yes |   1,024 | 43 sec |  42 ms |       1 MiB |
    | yes |   1,024 | 47 sec |  46 ms |       1 MiB |
    | yes |   1,024 | 48 sec |  46 ms |       1 MiB |
    | yes |   1,024 | 42 sec |  41 ms |       1 MiB |
    | yes |   1,024 | 47 sec |  46 ms |       1 MiB |
    | yes |   1,024 | 42 sec |  41 ms |       1 MiB |
    | yes |   1,024 | 45 sec |  44 ms |       1 MiB |
    | yes |   1,024 | 43 sec |  42 ms |       1 MiB |
    | yes |   1,024 | 37 sec |  37 ms |       1 MiB |
    | yes |   1,024 | 49 sec |  48 ms |       1 MiB |
    | yes |   1,024 | 46 sec |  44 ms |       1 MiB |
    +-----+---------+--------+--------+-------------+
    Test 2 - MySQL
    Records: 16,777,214
    Record data size: 1024 B
    Size of table: 16.6 GiB
    Generation speed: about 700 files per second
    Deleting speed: 30 seconds
    +-----+---------+--------+--------+-------------+
    |found| entries |  time  |  avrg  | readed data |
    +-----+---------+--------+--------+-------------+
    | yes |   1,024 |  1 min |  66 ms |       1 MiB |
    | yes |   1,024 | 41 sec |  40 ms |       1 MiB |
    | yes |   1,024 | 41 sec |  40 ms |       1 MiB |
    | yes |   1,024 | 43 sec |  42 ms |       1 MiB |
    | yes |   1,024 | 41 sec |  40 ms |       1 MiB |
    | yes |   1,024 | 41 sec |  40 ms |       1 MiB |
    | yes |   1,024 | 40 sec |  39 ms |       1 MiB |
    | yes |   1,024 | 41 sec |  40 ms |       1 MiB |
    | yes |   1,024 | 40 sec |  39 ms |       1 MiB |
    | yes |   1,024 | 41 sec |  40 ms |       1 MiB |
    | yes |   1,024 | 40 sec |  39 ms |       1 MiB |
    | yes |   1,024 | 40 sec |  39 ms |       1 MiB |
    | yes |   1,024 | 40 sec |  39 ms |       1 MiB |
    | yes |   1,024 | 40 sec |  39 ms |       1 MiB |
    | yes |   1,024 | 41 sec |  40 ms |       1 MiB |
    | yes |   1,024 | 40 sec |  40 ms |       1 MiB |
    | yes |   1,024 | 40 sec |  39 ms |       1 MiB |
    | yes |   1,024 | 40 sec |  39 ms |       1 MiB |
    | yes |   1,024 | 40 sec |  39 ms |       1 MiB |
    | yes |   1,024 | 39 sec |  38 ms |       1 MiB |
    +-----+---------+--------+--------+-------------+So both ways are very similar, but MySQL was little faster and has more entries. My test computer is very bad, so it is hard to say wich way will be faster on some server with more RAM, fasters discs and CPU. But you were right, because MySQL was faster than FS. So maybe i will use database insteda of FS, because there is no limit and i can save som other info wich is in file's data now. Thanks that you compel me to try it.

  • Migration Requirements - drivers etc?

    Hi
    What software will I need to download to do a SQL server 2008 to oracle 11g express migration?
    I have already downloaded SQL oracle developer and the Oracle Workbech. Will I need to download a driver to? Where can I find the latest?
    I am using Windows 2008 server.
    Thanks
    Jan

    Jan,
    To make the connection from SQL*Developer to the SQL*Server database you will need to download a third party JDBC driver.
    This is described in the documentation available from here -
    http://docs.oracle.com/cd/E35137_01/index.htm
    Oracle® SQL Developer
    User's Guide Release 3.2
    In the section -
    Database: Third Party JDBC Drivers
    Database: Third Party JDBC Drivers
    The Third Party JDBC Drivers pane specifies drivers to be used for connections to third-party (non-Oracle) databases, such as IBM DB2, MySQL, Microsoft SQL Server, or Sybase Adaptive Server. (You do not need to add a driver for connections to Microsoft Access databases.) To add a driver, click Add Entry and select the path for the driver:
    ■For IBM DB2: the db2jcc.jar and db2jcc_license_cu.jar files, which are available from IBM
    ■For MySQL: a file with a name similar to mysql-connector-java-5.0.4-bin.jar, in a directory under the one into which you unzipped the download for the MySQL driver
    ■For Microsoft SQL Server or Sybase Adaptive Server: jtds-1.2.jar, which is included in the jtds-1.2-dist.zip download
    ■For Teradata: tdgssconfig.jar and terajdbc4.jar, which are included (along with a readme.txt file) in the TeraJDBC__indep_indep.12.00.00.110.zip or TeraJDBC__indep_indep.12.00.00.110.tar download
    Alternative:
    As an alternative to using this preference, you can click Help, then Check for Updates to install the JTDS JDBC Driver for Microsoft SQL Server and the MySQL JDBE Driver as extensions.
    To find a specific third-party JDBC driver, see the appropriate website (for example, http://www.mysql.com for the MySQL Connector/J JDBC driver for MySQL, http://jtds.sourceforge.net/ for the jTDS driver for Microsoft SQL Server and Sybase Adaptive Server, or search at http://www.teradata.com/ for the JDBC driver for Teradata). For MySQL, use the MySQL 5.0 driver, not 5.1 or later, with SQL Developer release 1.5.
    You must specify a third-party JDBC driver or install a driver using the Check for Updates feature before you can create a database connection to a third-party database of that associated type. (See the tabs for creating connections to third-party databases in the Create/Edit/Select Database Connection dialog box.)
    Regards,
    Mike

  • How to get the exact sql developer which used for data migration?

    Hi all,
    Hope doing well,
    Sir i seen a link for data migration that is : http://www.oracle.com/technetwork/developer-tools/sql-developer/sql-server-connection-viewlet-swf-089886.html
    in this link when they are connecting to sql database so after clicking on new connection four tab is showing that is oracle, access, my sql, sql server.
    i downloaded latest version of sql developer which version is: 3.02.09.30 when i opened this i am not getting those option.
    and one more thing i am not getting miragation menu name in menu items.
    please help me.
    thanks and regards

    Hi,
    To connect to non-Oracle databases from SQL*Developer youneed to download the relevant JDBC driver.
    This is detailed in the documentation in the User Guide -
    http://docs.oracle.com/cd/E35137_01/appdev.32/e35117.pdf
    in the section -
    Database: Third Party JDBC Drivers
    The Third Party JDBC Drivers pane specifies drivers to be used for connections to third-party (non-Oracle) databases, such as IBM DB2, MySQL, Microsoft SQL Server, or Sybase Adaptive Server. (You do not need to add a driver for connections to Microsoft Access databases.) To add a driver, click Add Entry and select the path for the driver:
    ■For IBM DB2: the db2jcc.jar and db2jcc_license_cu.jar files, which are available from IBM
    ■For MySQL: a file with a name similar to mysql-connector-java-5.0.4-bin.jar, in a directory under the one into which you unzipped the download for the MySQL driver
    ■For Microsoft SQL Server or Sybase Adaptive Server: jtds-1.2.jar, which is included in the jtds-1.2-dist.zip download
    ■For Teradata: tdgssconfig.jar and terajdbc4.jar, which are included (along with a readme.txt file) in the TeraJDBC__indep_indep.12.00.00.110.zip or TeraJDBC__indep_indep.12.00.00.110.tar download
    To find a specific third-party JDBC driver, see the appropriate website (for example, http://www.mysql.com for the MySQL Connector/J JDBC driver for MySQL, http://jtds.sourceforge.net/ for the jTDS driver for Microsoft SQL Server and Sybase Adaptive Server, or search at http://www.teradata.com/ for the JDBC driver for Teradata). For MySQL, use the MySQL 5.0 driver, not 5.1 or later, with SQL Developer release 1.5.
    You must specify a third-party JDBC driver or install a driver using the Check for Updates feature before you can create a database connection to a third-party database of that associated type. (See the tabs for creating connections to third-party databases in the Create/Edit/Select Database Connection dialog box.)
    Regards,
    Mike

  • Looking at Lion Server but can't tell what is really inlcuded

    I am thinking about getting the Mac Mini with Lion Server installed. How every, I have found the documentation to be confusing.  I am needing a Filemaker, SMTP, PHP, MySQL web server mainly. I would really like to talk to someone who is using this type of setup first.

    Indeed Lion will do all of what you need.  MySQL is not included with Lion however.  You'll need to install it yourself. 
    It's not that bad though.  I've walked a class of Grade 12's through it!  hehe
    Lion instead comes with PostgreSQL.  I'm not familiar with it, but I assume that it's basic functionaly is similar to MySQL.

  • Unix like previous command list using the arrow keys

    Similar to MySQL or Unix where one may utilize the up or down arrow to retrieve a list of old input to prevent retyping it, I am curious how I might do that in Java.
    I know I need to manipulate the output stream pointer so I can print from an array or vector collection all input on the same line until the old command is located and entered.
    Other than this, I am not sure how to go about doing this. My grasp of the language is not yet mature enough.

    The default console is very poor, so you can't even do that without extra native libraries (I believe JConsole was one).
    Although if you add some Swing, you can create a console-like system with a JFrame and some textfields.

  • Oracle 8i to 10g Express data migration?

    Howdy,
    I'm very new to Oracle so a lot of the terminology I'm not completely up to date on versus MySQL & MS-SQL.
    We have a new client who has an Oracle 8i system they have data in that we need to develop against and import from. We were looking into having them provide a copy of their DB that we would then run in a 10g Exp edition locally while we work on the data. The problem is I'm having a hard time finding documentation on how to actually perform this process? With MS-SQL I can make a backup file from an older version then import and the data is upgraded at that time, similarly with MySQL and their SQL backup files. What process would I need to do to restore/import an older 8i DB into a 10g type environment?

    Welcome to the forums !
    10g Express Edition has limited capabilities - see http://download.oracle.com/docs/cd/B25329_01/doc/license.102/b25456/toc.htm#BABJBGGA
    If any of the features not available in 10g Express Edition are being used in the 8i database, you will not be able to use 10g Express Edition. You will need one of the other editions - see http://download.oracle.com/docs/cd/B19306_01/license.102/b14199/editions.htm#BABJICBB
    How big is the 8i database ? You should be able to ask them to provide an export dump file (http://download.oracle.com/docs/cd/A87860_01/doc/index.htm) that you can then import into a suitable 10g database (http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/exp_imp.htm#sthref2591)
    This process requires some knowledge / experience with Oracle. Pl also note that both 8i and 10g versions are de-supported, so do not expect too much help from Oracle Support if you run into issues.
    HTH
    Srini

  • Is thre any row limit in JDBC ?

    Hi all .
    I have a DB Table that I use for logging in my application .
    And as you know a log table can have many rows ..
    In my application an administrator can
    se the log .
    So my question is :
    Is there any limit to the rows returned from a query .
    I am afraid that in future my program throws an
    OutOfMemory error or any other error.
    Is there any way to get best performance in such situation ?
    Thanks.
    Omar Dawod.

    > I can start , or give me sample codes ?
    Well there are many threads in this forums addressing the same issue if you are still not satisfied use google by puttin the right key words...
    http://onesearch.sun.com/search/onesearch/index.jsp?qt=pagination&qp_name=null&subCat=siteforumid%3Ajava48&site=dev&dftab=siteforumid%3Ajava48&chooseCat=javaall&col=developer-forums
    http://onesearch.sun.com/search/onesearch/index.jsp?qt=pagination&qp_name=null&subCat=siteforumid%3Ajava45&site=dev&dftab=siteforumid%3Ajava45&chooseCat=javaall&col=developer-forums
    http://www.google.co.in/search?hl=en&q=pagination+jdbc&meta=
    > About the "pagination" , It would be very nice to
    include "pagination" ,
    but does JDBC offer this to me
    It is not a readmade feature u may design it as per ur convinice......
    and this is because it is highly application(DB) specific.
    Just to quote an example....
    Say
    select COUNT(*) from TableName
    gives you total number of records....
    in a database like oracle... U can restructure the query like the one below
    select * from TableName WHERE rownum >= [LIMIT1] and rownum <= [LIMIT2]
    where LIMIT1 < LIMIT2 <= COUNT(*)
    fix a value for [LIMIT2] - [LIMIT1] depending on SYSPARAMETERS.....
    U can design a bean which does this task for U....
    In similar ways different Databases offer a similar functionality
    MYSQL --> use of LIMIT & OFFSET clause
    SQL SERVER 2005 ---> rownum()
    and so on....
    Other than this approch there are few other methods by which one can acheive it.
    Please go through the link below
    http://www.devx.com/Java/Article/21383/1763
    > any way to limit the rows in JDBC .
    U can do it to certain extent Using ResultSet.setFetchSize(int rows) method as said by my fellow forum mate cotton.m.

  • J_security_check users from MySQL (or a similar authentication method)?

    After trying to write an authentication system using sessions (and failing), I did some research and found out about j_security_check.
    After searching for ways to use this and coming across several forum posts that never seemed to accomplish anything close to what I'm attempting to do, the closest method for doing this would only get user data from the tomcat-users.xml file.
    Normally, this would work, but I'm aiming for a way to allow users to register, and a SQL database seems like the best way to do this. (plus, I don't want to mess around with file permissions and such)
    Is reading the user data from MySQL possible? If not, is there a decent way to accomplish something close to this (that works with Tomcat 6- all the guides I read seemed to refer to SJSAS-specific features)?
    Thanks!
    Also, here's the code I'm currently using from web.xml if that helps at all:
    <login-config>
            <auth-method>FORM</auth-method>
            <realm-name>CMS Login</realm-name>
            <form-login-config>
                <form-login-page>/index.jsp?page=pages/login/login.jspf</form-login-page>
                <form-error-page>/index.jsp?page=pages/login/error.jspf</form-error-page>
            </form-login-config>
        </login-config>

    Yes you can store the usernames passwords anywhere you want to.
    In Tomcat they refer to this "database" of usernames/passwords as a Realm
    http://tomcat.apache.org/tomcat-6.0-doc/realm-howto.html
    The default implementation is the MemoryRealm which reads from that tomcat-users.xml file.
    You can instead use a JDBCRealm or DatasourceRealm (Better IMO) to locate the usernames/passwords. It just requires configuration of the server.
    Cheers,
    evnafets

  • Help changing to prepared statements for mysqli

    I am trying to change previously working php pages from mysql to mysqli using prepared statements.
    I am having problems with an error message.
    Basically the page I have just changed produces a set of database results depending on list menu and check box criteria from user input. I run 2 queries, one to find the total number of records, and the other to retrieve the required subset for pagination. All works fine. However if there are no actual results found from the requested input my php script then uses an includes file which basically runs the same 2 queries but with the user criteria narrowed down so that similar options are presented to the user. This is where my problem lies, for some unknown to me reason the second set of queries is producing no results and an error:
    'Attempt to read a row while there is no result set associated with the statement'
    If I run the second set of queries without running the first set then the second set works fine so I know that it is not the statements themselves but something in my new code. How can the first set of queries be affecting the results of the second set?
    Here is the code below which produces the first 2 queries that work, and below it the same code for the second 2 queries (which is from an 'Includes' file and is the same code exactly except the EXPECTED parameters $expected have been narrowed down in the expected array and list of params for binding).
    //list of possible field input by user
    $expected = array('location'   => 'text',
                      'type' => 'text',
                      'beds' => 'text',
                      'price' => 'text',
    'nbuild'     => 'int',
    'resale'     => 'int',
    'coastal'    => 'int',
    'seaview'    => 'int',
    'rural'      => 'int',
    'golf'       => 'int',
    'ppool'      => 'int',
    'comp'       => 'int',                            
    'garden'     => 'int',
    'terrace'    => 'int',
    'aircon'     => 'int',
    'heating'    => 'int',
    'garage'     => 'int',
    'telephone'  => 'int',
    'furnished'  => 'int',
    'internet'   => 'int',
    'dpaid'      => 'int',
    'propid'     => 'text');
    define('SHOWMAX', 10);
    // prepare SQL to get total records
    $getTotal = 'SELECT COUNT(*) FROM detailstable JOIN newloctable ON detailstable.location=newloctable.newlocid JOIN typetable ON detailstable.type=typetable.typeid JOIN pricetable ON detailstable.price=pricetable.priceid JOIN bedtable ON detailstable.beds=bedtable.bedid JOIN photossale ON detailstable.detailsid=photossale.propsaleid ';
    // Set a flag to indicate whether the query has a WHERE clause
    $where = false;
    // Loop through the associatiave array of expected search values
    foreach ($expected as $var => $type) {
      if (isset($_GET[$var])) {
        $value = trim(urldecode($_GET[$var]));
        if (!empty($value)) {
          // Check if the value begins with > or <
          // If so, use it as the operator, and extract the value
          if ($value[0] == '>' || $value[0] == '<') {
            $operator = $value[0];
            $value = ltrim(substr($value, 1));
          } elseif (strtolower($type) != 'like') {
            $operator = '=';
          // Check if the WHERE clause has been added yet
          if ($where) {
            $getTotal .= ' AND ';
          } else {
            $getTotal .= ' WHERE ';
            $where = true;
          // Build the SQL query using the right operator and data type
           $type = strtolower($type);
          switch($type) {
            case 'like':
              $getTotal .= "`$var` LIKE ? ";
              break;
            case 'int':
            case 'double':
            case 'date':
              $getTotal .= "`$var` $operator ? ";
              break;
            default:
            $getTotal .= "`$var` = ? ";
    $getTotal .= ' ORDER BY ABS(detailstable.trueprice), bedtable.number, detailstable.propid ASC';
    $stmt = $conn->stmt_init();
    if ($stmt->prepare($getTotal)) {
    $params = array($_GET['location'], $_GET['type'], $_GET['beds'], $_GET['price'], $_GET['nbuild'], $_GET['resale'], $_GET['coastal'], $_GET['seaview'], $_GET['rural'], $_GET['golf'], $_GET['ppool'], $_GET['comp'], $_GET['garden'], $_GET['terrace'],
    $_GET['aircon'], $_GET['heating'], $_GET['garage'], $_GET['telephone'], $_GET['furnished'], $_GET['internet'], $_GET['dpaid'], $_GET['propid']);
    $params = array_filter($params);
    $params = array_values($params);
    if (!empty($params)) {
                $types = '';
                foreach($params as $param) {
                    // set param type
                    if (is_string($param)) {
                        $types .= 's';  // strings
                    } else if (is_int($param)) {
                        $types .= 'i';  // integer
                    } else if (is_float($param)) {
                        $types .= 'd';  // double
                    } else {
                        $types .= 'b';  // default: blob and unknown types
                $bind_names[] = $types;
                for ($i=0; $i<count($params);$i++) {
                    $bind_name = 'bind' . $i;      
                    $$bind_name = $params[$i];     
    $bind_names[] = &$$bind_name;  
    call_user_func_array(array(&$stmt,'bind_param'),$bind_names);
    $stmt->execute();
    $stmt->store_result();
    $stmt->bind_result($total);
    $stmt->fetch();
    // sort paging
    $totalRecords = $total;
    $stmt->free_result();
    $stmt->close();
    // check that there is at least 1 result and if there is do the second part of the search
    // if there is no result then I skip this second bit of code
    if($totalRecords > '0') {
    // check current page
    if (isset($_GET['curPage'])) {
    $curPage = $_GET['curPage'];
    } else {
    $curPage = 0;
    // calculate the start row of the subset
    $startRow = $curPage * SHOWMAX;        
    $sql = "SELECT DISTINCT detailsid, trueprice, reduced, offers, `desc`, `propid`, `bathrooms`, `location`, `type`, `price`, `beds`, photossale.photo1, newloctable.newloc,   typetable.style, bedtable.`number` FROM detailstable JOIN newloctable ON detailstable.location=newloctable.newlocid JOIN typetable ON detailstable.type=typetable.typeid JOIN pricetable ON detailstable.price=pricetable.priceid JOIN bedtable ON detailstable.beds=bedtable.bedid JOIN photossale ON detailstable.detailsid=photossale.propsaleid ";
    // Set a flag to indicate whether the query has a WHERE clause
    $where = false;
    // Loop through the associatiave array of expected search values
    foreach ($expected as $var => $type) {
      if (isset($_GET[$var])) {
        $value = trim(urldecode($_GET[$var]));
        if (!empty($value)) {
          // Check if the value begins with > or <
          // If so, use it as the operator, and extract the value
          if ($value[0] == '>' || $value[0] == '<') {
            $operator = $value[0];
            $value = ltrim(substr($value, 1));
          } elseif (strtolower($type) != 'like') {
            $operator = '=';
          // Check if the WHERE clause has been added yet
          if ($where) {
            $sql .= ' AND ';
          } else {
            $sql .= ' WHERE ';
            $where = true;
          // Build the SQL query using the right operator and data type
           $type = strtolower($type);
          switch($type) {
            case 'like':
              $sql .= "`$var` LIKE  ? ";
              break;
            case 'int':
            case 'double':
            case 'date':
              $sql .= "`$var` $operator ? ";
              break;
            default:
            $sql .= "`$var` = ? ";
    $sql .= " ORDER BY ABS(detailstable.trueprice), bedtable.number, detailstable.propid ASC LIMIT $startRow," . SHOWMAX;
    $stmt = $conn->stmt_init();
    if ($stmt->prepare($sql)) {
    $nextparams = $params;
    if (!empty($nextparams)) {
                $nexttypes = '';
    foreach($nextparams as $nextparam) {
                    // set param type
                    if (is_string($nextparam)) {
    $nexttypes .= 's';  // strings
                    } else if (is_int($nextparam)) {
    $nexttypes .= 'i';  // integer
                    } else if (is_float($nextparam)) {
    $nexttypes .= 'd';  // double
                    } else {
    $nexttypes .= 'b';  // default: blob and unknown types
                $newbind_names[] = $nexttypes;
                for ($i=0; $i<count($nextparams);$i++) {
    $newbind_name = 'bind' . $i;      
    $$newbind_name = $nextparams[$i];
    $newbind_names[] = &$$newbind_name;
    call_user_func_array(array(&$stmt,'bind_param'),$newbind_names);
    $stmt->execute();
    $stmt->store_result();
    $stmt->bind_result($detailsid, $trueprice, $reduced, $offers, $desc, $propid, $bathrooms, $location, $type, $price, $beds, $photo1, $newloc, $style, $bednumber);
    $numRows = $stmt->num_rows;
    If a result was found in the part that checks the numbers of records then the second query is run and displayed using : while ($stmt->fetch()) { ...... to display the results and then I use $stmt->free_result();
    $stmt->close();
    All fine no problems.
    If the first query did not find a result then the second query is skipped and instead the script then uses a php includes file with exactly the same script as above except the expected params are narrowed as below: THIS IS WHEN I GET NO RESULTS – when I do expect to get a result) AND AN ERROR OF :
    Attempt to read a row while there is no result set associated with the statement.
    Yet if I run the includes file and skip the whole of the above code the code in the includes file find the result no problem. Anyway code below:
    $expected = array('location'   => 'text',
                      'type' => 'text',
                      'beds' => 'text',
                      'price' => 'text',
    'dpaid'      => 'int',
    'propid'     => 'text');
    define('SHOWMAX', 10);
    // prepare SQL to get total records
    $getTotal = 'SELECT COUNT(*) FROM detailstable JOIN newloctable ON detailstable.location=newloctable.newlocid JOIN typetable ON detailstable.type=typetable.typeid JOIN pricetable ON detailstable.price=pricetable.priceid JOIN bedtable ON detailstable.beds=bedtable.bedid JOIN photossale ON detailstable.detailsid=photossale.propsaleid ';
    // Set a flag to indicate whether the query has a WHERE clause
    $where = false;
    // Loop through the associatiave array of expected search values
    foreach ($expected as $var => $type) {
      if (isset($_GET[$var])) {
        $value = trim(urldecode($_GET[$var]));
        if (!empty($value)) {
          // Check if the value begins with > or <
          // If so, use it as the operator, and extract the value
          if ($value[0] == '>' || $value[0] == '<') {
            $operator = $value[0];
            $value = ltrim(substr($value, 1));
          } elseif (strtolower($type) != 'like') {
            $operator = '=';
          // Check if the WHERE clause has been added yet
          if ($where) {
            $getTotal .= ' AND ';
          } else {
            $getTotal .= ' WHERE ';
            $where = true;
          // Build the SQL query using the right operator and data type
           $type = strtolower($type);
          switch($type) {
            case 'like':
              $getTotal .= "`$var` LIKE ? ";
              break;
            case 'int':
            case 'double':
            case 'date':
              $getTotal .= "`$var` $operator ? ";
              break;
            default:
            $getTotal .= "`$var` = ? ";
    $getTotal .= ' ORDER BY ABS(detailstable.trueprice), bedtable.number, detailstable.propid ASC';
    $stmt = $conn->stmt_init();
    if ($stmt->prepare($getTotal)) {
    $params = array($_GET['location'], $_GET['type'], $_GET['beds'], $_GET['price'], $_GET['dpaid'], $_GET['propid']);
    $params = array_filter($params);
    $params = array_values($params);
    if (!empty($params)) {
                $types = '';
                foreach($params as $param) {
                    // set param type
                    if (is_string($param)) {
                        $types .= 's';  // strings
                    } else if (is_int($param)) {
                        $types .= 'i';  // integer
                    } else if (is_float($param)) {
                        $types .= 'd';  // double
                    } else {
                        $types .= 'b';  // default: blob and unknown types
                $bind_names[] = $types;
                for ($i=0; $i<count($params);$i++) {
                    $bind_name = 'bind' . $i;      
                    $$bind_name = $params[$i];     
    $bind_names[] = &$$bind_name;  
    call_user_func_array(array(&$stmt,'bind_param'),$bind_names);
    $stmt->execute();
    $stmt->store_result();
    $stmt->bind_result($total);
    $stmt->fetch();
    // sort paging
    $totalRecords2 = $total;
    echo $stmt->error;
    $stmt->free_result();
    $stmt->close();
    // there is a result get the subset
    if($totalRecords2 > '0') {
    // check current page
    if (isset($_GET['curPage'])) {
    $curPage = $_GET['curPage'];
    } else {
    $curPage = 0;
    // calculate the start row of the subset
    $startRow = $curPage * SHOWMAX;        
    $sql = "SELECT DISTINCT detailsid, trueprice, reduced, offers, `desc`, `propid`, `bathrooms`, `location`, `type`, `price`, `beds`, photossale.photo1, newloctable.newloc,   typetable.style, bedtable.`number` FROM detailstable JOIN newloctable ON detailstable.location=newloctable.newlocid JOIN typetable ON detailstable.type=typetable.typeid JOIN pricetable ON detailstable.price=pricetable.priceid JOIN bedtable ON detailstable.beds=bedtable.bedid JOIN photossale ON detailstable.detailsid=photossale.propsaleid ";
    // Set a flag to indicate whether the query has a WHERE clause
    $where = false;
    // Loop through the associatiave array of expected search values
    foreach ($expected as $var => $type) {
      if (isset($_GET[$var])) {
        $value = trim(urldecode($_GET[$var]));
        if (!empty($value)) {
          // Check if the value begins with > or <
          // If so, use it as the operator, and extract the value
          if ($value[0] == '>' || $value[0] == '<') {
            $operator = $value[0];
            $value = ltrim(substr($value, 1));
          } elseif (strtolower($type) != 'like') {
            $operator = '=';
          // Check if the WHERE clause has been added yet
          if ($where) {
            $sql .= ' AND ';
          } else {
            $sql .= ' WHERE ';
            $where = true;
          // Build the SQL query using the right operator and data type
           $type = strtolower($type);
          switch($type) {
            case 'like':
              $sql .= "`$var` LIKE  ? ";
              break;
            case 'int':
            case 'double':
            case 'date':
              $sql .= "`$var` $operator ? ";
              break;
            default:
            $sql .= "`$var` = ? ";
    $sql .= " ORDER BY ABS(detailstable.trueprice), bedtable.number, detailstable.propid ASC LIMIT $startRow," . SHOWMAX;
    $stmt = $conn->stmt_init();
    if ($stmt->prepare($sql)) {
    $nextparams = $params;
    if (!empty($nextparams)) {
                $nexttypes = '';
    foreach($nextparams as $nextparam) {
                    // set param type
                    if (is_string($nextparam)) {
    $nexttypes .= 's';  // strings
                    } else if (is_int($nextparam)) {
    $nexttypes .= 'i';  // integer
                    } else if (is_float($nextparam)) {
    $nexttypes .= 'd';  // double
                    } else {
    $nexttypes .= 'b';  // default: blob and unknown types
                $newbind_names[] = $nexttypes;
                for ($i=0; $i<count($nextparams);$i++) {
    $newbind_name = 'bind' . $i;      
    $$newbind_name = $nextparams[$i];
    $newbind_names[] = &$$newbind_name;
    call_user_func_array(array(&$stmt,'bind_param'),$newbind_names);
    $stmt->execute();
    $stmt->store_result();
    $stmt->bind_result($detailsid, $trueprice, $reduced, $offers, $desc, $propid, $bathrooms, $location, $type, $price, $beds, $photo1, $newloc, $style, $bednumber);
    $numRows = $stmt->num_rows;
    Again here I would then display the results before closing and freeing the stmt or display a message to say there were no results found from the criteria. But instead I get the error message and echoing the value of $totalRecords2 is empty.
    I have been pulling my hair out for days and days over this and as it is one of the first pages I am converting from mysql to mysqli I wonder if I am missing something very obvious to someone with more experience with the code.  I will be very grateful for any help, thank you in advance.

    You have intel graphics, that means the graphics cannot be upgraded.
    Welcome to the Toshiba user forums.
    For those of you who do not know what a user forum is, it is a community of users who volunteer time to help other users. Anyone can participate. It's 100% voluntary.
    Being super active is never a requirement

  • Can't display *proper* Chinese char in v3.0.04 connecting to MySQL

    Hello to all guru,
    I am having some trouble on displaying Chinese characters on SQLDeveloper connecting MySQL database...
    Database: MySQL 5.5.17, for Win32 (x86)
    SQLDeveloper: 3.0.04
    JDBC: Connector/J 5.1.18 from MySQL
    Connection has no problem, retrieving data also great.
    Using mysql.exe at Windows Command Prompt, it could display the proper Chinese characters perfectly...
    mysql> SHOW VARIABLES LIKE 'character_set_system';
    -----------------------------+
    | Variable_name | Value |
    -----------------------------+
    | character_set_system | utf8 |
    -----------------------------+
    1 row in set (0.09 sec)
    mysql> select display_name, display_name_chi
    -> from contact
    -> where display_name = 'David Chan';
    --------------------------------+
    | display_name | display_name_chi |
    --------------------------------+
    | David Chan | 陳大衛 |
    --------------------------------+
    1 row in set (0.00 sec)
    Run the same select query on SQLDeveloper, it shows...
    display_name     display_name_chi
    David Chan     ³¯¤j½Ã
    On SQLDeveloper, Tools > Preferences > Database > NLS, there seems to have some NLS settings to play with, and default settings are:
    Language: AMERICAN
    Territory: AMERICA
    Tried changing to the followings...
    Language: TRADITIONAL CHINESE
    Territory: TAIWAN
    Still displaying the monster characters... I haven't tested to see if SQLDeveloper would behave the same while connecting to Oracle Database, and I am thinking maybe just the Java GUI's issue?!
    Can anyone give me some idea?

    Hi,
    Here is a post that provides a solution for a similar Chinese language situation related to the Oracle JDBC driver:
    Re: Can't select using special characters (symbols)
    Perhaps you will be able to find something equivalent for the MySQL driver.
    Regards,
    Gary
    SQL Developer Team

  • What is the difference between Oracle and MySQL

    Hi,
    I would like to know the major difference between Oracle and MySQL. I have a project to generate XML files from database tables, i have used oracle's built XML functions XMLELEMENT, XMLATTRIBUTES, XMLFOREST, XMLAGG. I really want to know if these functions (or) similar functions are supported/availabe in MySQL.
    I am having a hard time to find out best linux distro for installing Oracle11g, so i am planning to switch to MySQL. Please help, Thanks in advance.

    Oracle_Walker wrote:
    Hi,
    <snip>>
    I am having a hard time to find out best linux distro for installing Oracle11g, Then you must be "looking for love in all the wrong places."
    What's so hard about finding a "best linux distro for installing Oracle11g"? The supported distros are listed in the fine Installation Guide for Linux. At the top of the list is Oracle's own Oracle Linux, which is in the same family as Red Hat.
    so i am planning to switch to MySQL. Please help, Thanks in advance.

  • Problem getting MySQL driver loaded in ODI Studio (ODI 11g)

    Hello -
    I am trying to create a new data server in the physical architecture under the MySQL technology. Since there is no MySQL JDBC driver included as there was in ODI 10g, I looked into the documentation to find a similar drivers directory that I had used in ODI 10g for loading other JDBC drivers. I would like to be able to select the MySQL Connector/J driver from the drop-down list of usable drivers in the Driver dialog window. I found this link, that explains how to install drivers:
    http://download.oracle.com/docs/cd/E14571_01/core.1111/e16453/install.htm#CHDBIFAJ
    I followed the documents instructions, added the file "mysql-connector-java-5.1.13-bin.jar" to my directory "C:\Documents and Settings\<my username>\Application Data\odi\oracledi\userlib" and restarted ODI Studio. I still cannot get the app to recognize the new driver to use, am I missing a step or is there a known issue with this method? More importantly has anyone been able to get this to register with the Driver dialog box successfully?
    With ODI Studio open, I attempted to delete the mysql jar file from my userlib directory and there was an error that said the file was in use... so I assume that ODI Studio is using the file but not registering it within the Driver selection dialog.

    I think we found our own answer... apparently the ODI Studio interface does not dynamically load that drop-down list from registered drivers in the classpath. We can still use the driver name by manually typing it into the "JDBC Driver:" text box.

Maybe you are looking for

  • Spinning ball when saving

    I have a brand new macbook air.  I just bought pages.  When I save, it gives me the spinning beach ball for 30 seconds.  This happens every 3rd save or so.  I erased the com.apple.iWork   plist files relating to pages... I am not a novice user, but I

  • Trying to add an input language

    hey guys i'm tryin to add an input language to my blackberry bold 9700 through the blackberry desktop application. but i'm getting this msg every time i try to " validation failed because the module marked for add (Klondike_v46_480x360) failed the ch

  • PDF To Video for Training

    Ok... I know silly question. I have a multi-page pdf that I need to creat a movie of by basically having the ability to have a page up and lay an audio track of instruction under it. I am not sure if imovie is my best tool, but I don't see a quick wa

  • StringIndexOutOfBoundsException while doing a subString()

    Hi, I am parsing out a data set (lottery numbers) and want to return each 2 digit number back as a seperate string. However, about halfway through the 1000 lines of numbers I get a "Exception occurred during event dispatching:java.lang.StringIndexOut

  • Poor performance from airport express u

    I have a time capsule as my base station connected to a DSL router.  I have to AP Express units.  I'm in a building with concrete walls.  The time capsule is at one end of the condo, the first express is in the middle and the second express at the ot