Query a database - connection duplicated error.

I use the following to select data in my database:

QVariantList Database::queryDatabase(const QString query)
{
    QVariantList sqlData;
    SqlDataAccess sqlDataAccess(mDbNameWithPath);
    sqlData.clear();
    sqlData = sqlDataAccess.execute(query).value();

    if (sqlDataAccess.hasError()) {
        DataAccessError err = sqlDataAccess.error();
        qWarning() << "SQL error: type=" << err.errorType() << ": " << err.errorMessage();
        return sqlData;
    }
    return sqlData;
}

The problem is when I run the above method for the second time, I get the warning:

Warning: QSqlDatabasePrivate::addDatabase: duplicate connection name 'data/drums.db', old connection removed.

This is due to the line:

SqlDataAccess sqlDataAccess(mDbNameWithPath);

I was wondering how I could go about deleting the warning, I have no idea how create sqlDataAccess as a global var, maybe this would settle it.

If anyone can help then I would appreciate it.

Thank you

Thank you! Inherit QObject class:

(1) add #include

2)

class DataBase : public QObject
{
  Q_OBJECT
public:
  Database();
  ...

This way you can use the parent-child of QObject mechanism to control the lifetime of the object.

It seems that forum has some formatting issues.

bb::data::SqlDataAccess

is bb [Colon] [Colon] data [Colon] [Colon] SqlDataAccess, right?

p. s.

It is not recommended to use "using namespace" in the .h files, it will pollute the namespace of each .cpp file that contains this header. It is better to use full qualified names in the .h files and move this line to the .cpp file:

using namespace bb::data;

Tags: BlackBerry Developers

Similar Questions

  • Database connectivity error: ADO...?

    I'm trying to export data in an Oracle database local using the Toolbox Database Connectivity.

    (I created my TEST table in the local Oracle database, I can access, write, read, etc. using SQL.) I also have the .dsn file that works with SQL)

    I get the following error:

    I found the problem. Not associated with LabVIEW (Duh...).

    Basically I have two copies of .tns names in two different folders. One of the files that I used to make a connection

    to the database did not have the correct login info and the other did. One who did was one I used.

  • I use windows 7 64-bit edition Home premium and I cannot connect to access database in java program.it shows error database connection driver not installed.

    I am using windows 7 64 bit home premium I installed ms office 2007 and did all the settings.
    but I am unable to connect to the Access database in java program.it shows error database connection driver not installed.
    Please give me the solution...

    Hello

    I suggest you to ask your question about Java programming forums on the subject.

    https://forums.Oracle.com/Forums/Forum.jspa?forumid=922

    You can also ask your question on the forums to access.

    http://answers.Microsoft.com/en-us/Office/forum/access?page=1&tab=all&TM=1349633636662

  • Database connection - error of creation of the admin user Setup. No route to host

    During step 2: configuration of the database connection we select the "internal database".
    After a short delay, we get a message saying "error of creation of the admin user. No route to the host.
    I have been more before DNS records and back and everything seems in good condition.
    Can someone point me in the right direction to solve this error?
    HW-Error.jpg

    This is an SSL certificate error. Have you changed the default self-signed SSL certificates?

  • Calling stored procedures with parameters with the database connectivity Toolkit

    Hi all

    I'm new to the forum and struggling to find a solution to a particular problem I have in this respect, using the LabVIEW Database Connectivity Toolkit on a project, I am currently working on my work.  I have a database in which I tables and stored procedures with parameters.  Some of these stored procedures have input, output and return parameters.

    I tried to follow this example, but to no avail: http://digital.ni.com/public.nsf/allkb/07FD130746083E0686257300006326C4?OpenDocument

    Such a stored procedure I am working on the implementation is named "dbo.getAllowablePNs", running "SELECT * from DeviceType" (DeviceType is the table).  In this case, it requires no input parameter, it has an output parameter that generates the table [cluster] and has a return parameter that returns an integer value (status code for execution) to show if an error occurred.  The DeviceType table has 3 columns; ID (PK, int not null), PN (nvarchar ((15), null) and NumMACAddresses (int, null).)  I have surpassed many examples and I talk to the support OR try to implement this and similar procedures stored in LabVIEW but have not been successful.  I am able to connect to the database with the VI of open connection without error, but spin in some confusion as a result of this step.  I then try to use the VI of parameter query create to call the stored procedure and set the parameters.  I guess I would then use the Set parameter value for each parameter that is connected to the entry of parameters on the previous query with parameters VI VI?  I am also having some confusion during and after these steps as well.  I would greatly appreciate advice or suggestions that anyone could have in this situation because I am not a SQL expert.  Also, I would be happy to provide more information that might be useful.

    Kind regards

    Jon

    Here's what I use to do this.  I think I had to change him create parameterized query VI for him to work.  There is a post on the forum about this somewhere.

  • Access to oracle10g XE database connectivity

    Dear friends,

    I made a link for you to connect to the access database of oracle10g XE with the help of the http://www.orafaq.com/node/60 link.
    I did everything perfectly, as shown in the link.

    In the last when I run the SQL query, it gives the following error.

    ORA-28500 Oracle connection to the non-oracle system returned this message...

    Can any1 help me on this to solve the problem. I'll be very grateful to you.

    Concerning
    Kamran

    Hello Ken,

    I agree with orafad - you need to transfer this issue to {forum: id = 63}. You must provide all the details you gathered in this thread (including the answers to my questions below) in your new position.

    The installation program itself looks OK. But you missed an important point:

    1 Oralce10g XE, Windows 7, MS Access 2007

    'Windows 7' is too general, as it is more a family name for several editions that exist. As noted by Daniel, the error you receive could be a problem for 32/64-bit. Your 10g XE is certainly running 32-bit. What of your windows? If your ODBC drivers are the tree of 64-bit, you will not be able to use 10g XE listener.

    3 listening port is as follows.

    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = hsodbc)
    (ORACLE_HOME = C:\oraclexe\app\oracle\product\10.2.0\server)
    (PROGRAM = hsodbc)
    )

    You dropped the SID XE or is it still in the SID_LIST?

    And another question for troubleshooting below: what do you see in the newspaper of the listener (usually % ORACLE_HOME%\network\log\listener.log) file when you try to select from your Access database? I expect to find a more complete error message there.

    -Udo

  • teststand to the remote database connection

    I have a test station in teststand running factory.  I want to log/query a database located on a network server in my installation by ethernet.  Can TestStand using its types of step address/access database this database for viewing and querying records?

    TestStand features of database, including the types of step of database using Microsoft ADO/OLE DB layer and providers installed on a system. Microsoft has an ODBC provider, TestStand can talk to any remote database system that supports the technology of this software. Take a look at the help topic "TestStand Database Fundamentals" in the online help for more information on this. Suggestion of love to look at the example is right on.

    Step TestStand database types are a way to access a database at a high level, but if you want to process the data in a more complex way, you can consider your connectivity database and processing in a code module using the programming language of your choice and call this code of TestStand module.

  • Database connectivity Kit

    Hello

    I use the database connectivity toolkit to create a Microsoft access database.  I'm new to the Toolbox.  I've read the tutorials online and following the instructions.  I created an empty Microsoft Access file with an .mdb extension.  I also created a link to data .udl with tools > create data... in LabView and linked to the mdb file.  My code VI is attached.  I get the following error when I run the program (also attached).  I don't know what causes this error.  I appreciate your help.

    Thank you

    You can not create a table with the name "table".  It is a key word.

  • Reading large data using the database connectivity

    Hello

    I use the Labview database connectivity toolkit to connect to my database sqlitev3 (I'm using ODBC). I just have to connect to the database (using the block of open_connection) and read all the values inside (using the select_data block). The problem is that my database is huge (about 2 GB), and I get this error:

    . VI NI_Database_API.lvlib:Rec FETCH Recordset Data (R)-> NI_Database_API.lvlibB Tools Select Data.vi-> real_web.vi-> real_web.vi.ProxyCallerADO error: 0x8007000E Exception occurred in provider: not enough memory is available to complete this operation. in .vi NI_Database_API.lvlib:Rec Fetch Recordset Data (R)-> NI_Database_API.lvlibB Tools Select Data.vi-> real_web.vi-> real_web.vi.ProxyCaller

    What should I do? It seems that he reads the data in the memory and it doesn't have enough space for it. When I read the data I want to write to a file.

    Read it in pieces. Write each piece to the file, and then repeat with the next segment. Try to read and process all data in one shot is not very practical and you found out will not work.

  • database connection status indicator

    I want to put something on the front of my program which will indicate the status of database connection. I think to ask at the tables in the list (it should be displayed), if the connection is good, it shows error. I tried and I think it works very well, but I don't know if it's the right way to do it, there may be better ways there, could someone point out he for me?

    Best regards

    You certainly don't want to open and close the connection. Maybe it will fail, but the 'real' connection is good. Maybe the real one has failed but this other works opening and closing. This could happen if the server has the maximum number of connections.

    Your connection is little go far?

    A simple method to check the connection just must have a loop that executes periodically a meaningless statement.

  • Drop database connectable to including the file system data sheets files

    I did experiments with the connectable Oracle12c to database functionality and have noticed that when I "drop database connectable to pdb1 including datafiles', I get the message that the database snap-in has been dropped."  I also see that all files in the tablespace for the PDB except the SYSTEM data file have been deleted.


    I want to remove the folder that has been used for the pluggable database after that the PDB fell, but cannot because the file SYSTEM data is left behind.

    Is it possible to delete the data file SYSTEM for a pluggable database once he fell?  Or this part forever from the database of the container?

    Thank you

    This forum works on a Server Windows 2012.

    Thanks for the Bug information.  There is no error in the alert.log file, but I found a trace file with:

    ORA-01265: cannot remove the D:\ETC\ETC\SYSTEM01 DATA. DBF

    ORA-27056: could not delete file

    OSD-04024: cannot delete the file.

    S/O-error: (32 OS) the process cannot access the file because it is being used by another process.

    This seems to be the same problem as described in bug 17659954, so I can follow in investigating the recommendations of bug

    Thanks again

  • How to add a second database connection

    Hello

    I added a new database connection. Then, I want to create tables business components but I do not see the schema of the database connection newly added in the drop-down list schema.


    Is there something else to do to be able to add a second connection to the base?

    Thank you

    JDev 11.1.1.6

    DB connections are strongly coupled with modules of the application. The best way would be to create a new project template and use this second model to access the database. Then, you use each application as application root module modules so that each gets its own connection.

    If you need to have these two dbs data in a table or query, you must use a link db or synonym to access data from ad of your DB connections.

    Timo

  • OEM 12 c: installation problem in step 6 (database connection details)

    Hello

    I try to install OEM 12 c. However, before you start installation and configuration, I installed oracle database 11.2.0.1.0 on the same virtual machine.

    OS: Windows Server 64-bit

    In step 6 of the installation of 12 c (OEM 12.1.0.3) OEM, I'm giving the credentials needed in "Section of database connection", but get the error message below.

    ORa: 12514: TNS Listener does not currently of service requested in connect descriptor.

    I tried the same credentials on the SQL instructions and it worked.

    SQL > conn sys/manager@orcl as sysdba;

    Connected.

    Please let me know if I missed something.

    -PM

    can check you the status of home/bin/lsnrctl listener, lsnrctl stop/start the listener db.

    We also have model/vbox VM for EM you can also use them if that's the configuration test em: http://www.oracle.com/technetwork/oem/enterprise-manager/downloads/oem-templates-1741850.html

  • ORA-12518: TNS:listener could not hand off client connection (DBD ERROR: OCIServerAttach)

    Hi again,

    I'm on my business management console and the database Instance and the headset shows the green arrow, but the connection of the Agent of the Forum shows a red arrow down and the error:

    Status: failed

    Details: ORA-12518: TNS:listener could not hand off client connection (DBD ERROR: OCIServerAttach)

    My OraClrAgnt service is up and running (using winxp pro, oracle 11 g 2), I'm on my pc at home, all my ports are open (name of my machine's "abigail" and it's dmzhost)

    Any suggestions to solve this error?

    My Tnsnames ora file:

    ABIGAIL =

    (DESCRIPTION =

    (ADDRESS_LIST =

    (ADDRESS = (PROTOCOL = TCP) (HOST = ABIGAIL)(PORT = 1521))

    )

    (CONNECT_DATA =

    (SERVICE_NAME = orcl.0.0.10)

    )

    )

    LISTENER_ORCL =

    (DESCRIPTION =

    (ADDRESS_LIST =

    (ADDRESS = (PROTOCOL = TCP) (HOST = ABIGAIL)(PORT = 1521))

    )

    (CONNECT_DATA =

    (SID = ORCL)

    )

    )

    RMAN =

    (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP) (HOST = ABIGAIL)(PORT = 1521))

    (CONNECT_DATA =

    (SERVER = DEDICATED)

    (SERVICE_NAME = rman.abigail)

    )

    )

    My listener.ora

    SID_LIST_LISTENER =

    (SID_LIST =

    (SID_DESC =

    (SID_NAME = CLRExtProc)

    (ORACLE_HOME = E:\app\abigail\product\11.2.0\dbhome_1)

    (= Extproc PROGRAM)

    (ENVS = "EXTPROC_DLLS=ONLY:E:\app\abigail\product\11.2.0\dbhome_1\bin\oraclr11.dll")

    )

    )

    LISTENER =

    (DESCRIPTION_LIST =

    (DESCRIPTION =

    (ADDRESS = (PROTOCOL = CIP)(KEY = EXTPROC1521))

    (ADDRESS = (PROTOCOL = TCP) (HOST = ABIGAIL)(PORT = 1521))

    )

    )

    ADR_BASE_LISTENER = E:\app\abigail

    My SQLNET. ORA

    SQLNET. AUTHENTICATION_SERVICES = (NTS)

    NAMES. DIRECTORY_PATH = (EZCONNECT, TNSNAMES, LOCALHOST)

    NAMES. TRACE_LEVEL = ADMIN

    My alert file

    < time msg = "2013-10 - T 10, 20: 47:02.687 - 04:00 ' org_id = 'oracle' id_comp = 'tnslsnr'"

    type = 'UNKNOWN' level = '16' = host_id "ABIGAIL."

    host_addr =': 1' >

    < txt > 10 October 2013 20:47:01 * (CONNECT_DATA = (CID = (PROGRAM =)(HOST=__jdbc__) (USER = SYSTEM)) (SERVICE_NAME = orcl.0.0.10)) * (ADDRESS = (PROTOCOL = tcp (PORT = 38289))(HOST=127.0.0.1)) * establish * orcl.0.0.10 * 12518

    < / txt >

    < / msg >

    < time msg = "2013-10 - T 10, 20: 47:02.687 - 04:00 ' org_id = 'oracle' id_comp = 'tnslsnr'"

    type = 'UNKNOWN' level = '16' = host_id "ABIGAIL."

    host_addr =': 1' >

    < txt > TNS-12518: TNS:listener could not hand off client connection

    AMT-12560: TNS:protocol adapter error

    < / txt >

    < / msg >

    My listener status and services

    LSNRCTL > status

    Connection to (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521)))

    STATUS of the LISTENER

    ------------------------

    Alias LISTENER

    Version TNSLSNR for 32-bit Windows: Version 11.2.0.1.0 - Prod

    ction

    Start date October 10, 2013 22:47:58

    Uptime 0 days 0 h 2 min 1 sec

    Draw level off

    Security ON: OS Local Authentication

    SNMP OFF

    Listener parameter File E:\app\abigail\product\11.2.0\dbhome_1\network\admin\l

    istener.ora

    E:\app\abigail\diag\tnslsnr\ABIGAIL\listener\ale log listener

    rt\log. XML

    Summary of endpoints listening...

    (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))

    (DESCRIPTION = (ADDRESS = (PROTOCOL = tcp)(HOST=ABIGAIL) (PORT = 1521)))

    Summary of services...

    Service 'CLRExtProc' has 1 instance (s).

    Instance of 'CLRExtProc', status UNKNOWN, has 1 operation for this service...

    Service 'orcl.0.0.10' has 1 instance (s).

    Instance "orcl", State LOAN, has 8 managers of this service...

    The command completed successfully

    LSNRCTL > services

    Connection to (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521)))

    Summary of services...

    Service 'CLRExtProc' has 1 instance (s).

    Instance of 'CLRExtProc', status UNKNOWN, has 1 operation for this service...

    Managers:

    "DEDICATED" set up: 0 denied: 0

    LOCAL SERVER

    Service 'orcl.0.0.10' has 1 instance (s).

    Instance "orcl", State LOAN, has 8 managers of this service...

    Managers:

    "D006" put in place: 0 denied: current: 0 0 max: 800 status: loan

    DISPATCHER < machine: ABIGAIL, pid: 1312 >

    (ADDRESS = (PROTOCOL =)(HOST=ABIGAIL) (PORT = 1060) CST)

    "D005" put in place: 0 denied: 12 current: 0 max: 800 status: ready

    DISPATCHER < machine: ABIGAIL, pid: 1288 >

    (ADDRESS = (PROTOCOL =)(HOST=ABIGAIL) (PORT = 1061) CST)

    "D004" put in place: 0 denied: 1 current: 1 max: 16383 State: loan

    DISPATCHER < machine: ABIGAIL, pid: 1260 >

    (ADDRESS = (PROTOCOL = tcp)(HOST=ABIGAIL) (PORT = 1063))

    "D003" put in place: 0 denied: 1 current: 1 max: 16383 State: loan

    DISPATCHER < machine: ABIGAIL, pid: 1140 >

    (ADDRESS = (PROTOCOL = tcp (PORT = 1062))(HOST=ABIGAIL))

    "D002" put in place: 0 denied: 1 current: 1 max: 16383 State: loan

    DISPATCHER < machine: ABIGAIL, pid: 140 >

    (ADDRESS = (PROTOCOL = tcp (PORT = 1059))(HOST=ABIGAIL))

    "D001" put in place: 0 denied: 1 current: 1 max: 16383 State: loan

    DISPATCHER < machine: ABIGAIL, pid: 1072 >

    (ADDRESS = (PROTOCOL = tcp (PORT = 1057))(HOST=ABIGAIL))

    "D000" put in place: 0 denied: 1 current: 1 max: 16383 State: loan

    DISPATCHER < machine: ABIGAIL, pid: 748 >

    (ADDRESS = (PROTOCOL = tcp (PORT = 1058))(HOST=ABIGAIL))

    "DEDICATED" set up: 0 denied: 0 status: ready

    LOCAL SERVER

    The command completed successfully

    I added this on my listener.ora

    DIRECT_HANDOFF_TTC_LISTENER = OFF

    Now it works!

    Moral of the story, google is your friend lol. Thanks for replying tho!

  • Web IR client server (0): database connection information is not available.

    Hello

    We have improved our system of Hyperion 9.3 to EMP 11.1.2.2. We use mainly the declarant a SQR production and interactive reporting tools.

    Using the workspace as an admin if I'm running a BQY everything works fine, but when I try to do the same as other users I get the error "Server (0): database connection information is not accessible." The treatment is off"of the

    I migrated everything form the old version and don't have anything since the changes. It looks like a configuration problem and I tried to look and compare all current production (old system 9.3).

    Is anyone else facing the same problem before? Any suggestions on the place to watch.

    Thank you in advance.

    Hello

    You have to go to my oracle support of website link: https://support.oracle.com/epmos/faces/MosIndex.jspx?_afrLoop=7929796452543&_afrWindowMode=0&_adf.ctrl-state=113hdvh7xd_4

    Connect with your oracle ID and the password that you have for your business and looking for the number of the document in the "search knowledge base" that will appear in the upper right of the page.

    Research shows the document you and you can access it.

    I hope this helps.

Maybe you are looking for