How to connect database dynamically using zf3.? - zend-framework3

Here is the scenario, I have different database like document1, document2, document3 .... document100. These database are generating dynamically using same username and password.
So how I can connect this database dynamically using zf3.? I think it is not a good solution to give all connection string of all database in global.php, because these database are generating dynamically.
Please note that this should be work while running indexAction(), not before indexAction() function.
Please help me to find good solution.
Thanks in advance.

Related

How to create database in Redis

I am new to Redis and trying to create a new database. Also, How to write a connecting string to Redis database with C#.net? Please somebody help me how to implement this.
In general, all use StackExchange.Redis, you will find all you need in documentation

SQLite-PCL : Accessing my own created table?

I'm referring to SQLite-PCL tutorial here: https://code.tutsplus.com/tutorials/an-introduction-to-xamarinforms-and-sqlite--cms-23020
I'm very new to SQLite, so I'm lacking in knowledge in lots of basic things - I have tried Googling, can't understand most of it.
Is the call to new SQLiteConnection actually opens up the database or just saying that "the road to the database has been established, whether you access it or not is up to you"?
How do I check if there's already existing database in the devices? And if there is, how do I access it? I have Googled this, but it all seems to be a bit extreme - can't I just call simple OPEN the database?
Is it okay to have multiple SQLiteConnection instances to the same database, if I can be sure that I'm not going to do multiple transaction at the same time?
After I have INSERT into the database, close the app, open up the app back - how do I make sure that there is database created in previous session? Any way to debug this? Because I have no idea if the database is there or not, and I don't know how to access it either..
SQLiteConnection returns a connection object that is used to make subsequent queries
use File.Exists to see if the db file is already present
Yes
Again, use File exists to see if the db file is physically present
Xamarin's ToDo sample provides a good overview of using SQLite with Forms.

item reader in spring batch is not able to read a oracle table

Item reader in spring batch is able to read other tables But it is not able to read a table. But I am able to read it in sql developer. I am getting exception like reader initialization failed.
Can Someone help me on this?
I found the mistake i have done. The user which i am using in java to access db hasn't privilege for the table i am trying to access.. In SQL developer i am using the user which has privilege for all the tables.
Thanks a lot for your response and time.

Qt - How to list all existing databases on PostgreSQL server using Qt interface

Could someone please explain how to obtain a list of all existing databases on a PostgreSQL server, to which the user already has access, using Qt? PostgreSQL documentation suggests the following query:
SELECT datname FROM pg_database WHERE datistemplate = false;
What are the correct parameters to the following functions:
QSqlDatabase::setDatabaseName(const QString & name) //"postgres" or "pg_database"?
QSqlDatabase::setUserName(const QString & name) //actual user name?
QSqlDatabase::setPassword(const QString & password) //no password? or user password?
Much appreciated. Thank you in advance.
You appear to have already answered the first part of your question. Connect to the postgres or template1 database and issue the query you've quoted above to get a list of databases. I'm guessing - reading between the lines - that you don't know how to connect to PostgreSQL to send that query, and that's what the second part of your question is about. Right?
If so, the QSqlDatabase accessor functions you've mentioned are used to set connection parameters, so the "correct" values depend on your environment.
If you want to issue the query above - to list databases - then you would probably want to connect to the postgres database as it always exists and isn't generally used for anything specific, it's there just to be connected to. That means you'd call setDatabaseName("postgres");. Passing pg_database to setDatabaseName would be nonsensical, since pg_database is the pg_catalog.pg_database table, it isn't a database you can connect to. pg_database is one of those odd tables that exists in every database, which might be what confused you.
With the other two accessors specify the appropriate username and password for your environment, same as you'd use for psql; there's no possible way I could tell you which ones to use.
Note that if you set a password but one isn't required because authentication is done over unix socket ident, trust, or other non-password scheme the password will be ignored.
If this doesn't cover your question, consider editing it and explaining your problem in more detail. What've you tried? What didn't work how you expected? Error messages? Qt version?

I don't know how to connect between the site and my database

I'm using SQL server and web developer(C#).
I know I should do something with my connection string, but I don't exactly what and where I should do that.
Can you write me code example
or explain me what to do?
Edit:
I should connect my database with the site(the site is on the internet).
how would i know the right path for this database?
I should put his address, IP or what?
first you have to know that you cannot just add the database to the server like this !!!
you have to script the whole database, and then you have to upload it into your database server like godaddy.com or what ever . your hosting server should support you with these setails ,they gonna give you a user name and password and other details so you can access to the sql manger ( like my ltitladmin) online ....there you have to upload or just copy and execute your code directly so you can make all your tables and stored procedures or what ever ....
after all this all what you have to is just take the online database new connection string and then add it o your web.confg or in you pages ,this is the way how to make it work right.
It depends on your ASP.NET application.
Basically, connection strings could be stored anywere.
One of suggested connection strings' store is Web.config file. Look for "connectionStrings" configuration element and you should find there the one to change for your production server.
Look at this page:
http://www.connectionstrings.com/
You'll find SQL Server connection string examples.
there is a lot os ways to do that, try to take a look to this simple example:
http://www.csharp-station.com/Tutorials/AdoDotNet/Lesson02.aspx
I guess you need to read about it a little:
http://msdn.microsoft.com/en-us/library/ff648340.aspx

Resources