After I uploaded my application created using cakephp, I found out that I had to rename the database. I renamed my database accordingly and changed the settings in the database.php file in the "config" folder. But my application is still not running.
I am being shown this error message
"Missing Database table"
"Error: Database table tbl_topics for model Topic was not found."
I have double checked the existence of tbl_topics in the database (it is there in the database) but the application says "table not found"
what might be the problem, please help me out...
Make sure the host/user/pass that you've set-up in the config.php file have access to that database and table
You could also try running cake schema generate --dry which will spit back any problems with the connection that you might be having
Also have a look in your app/tmp/logs for some extra information on the problems you are experiencing
Take the username and password you are using for cakephp and it's db connection and connect to the database from the command line. I'm presuming you are using a unix-type system and mysql?
mysql --user=user_name --password=your_password db_name
...and then try to run a simple select:
SELECT * FROM tbl_topics
If you get an error there, it will at least identify that it is a low level db problem and the likely solution is that you need to grant permissions to that username to select from that database. Your current access levels for that user is probably granting access to the db under the old name.
You have probably uploaded your cache files as well. Make sure you delete all the files in /app/tmp/cache/*
Warning: Don't delete the folders, files only!
Also, make sure your tmp folder and all the subfolders are world-writable.
One last thought would be to check your model cache. I don't know why that would impact you with respect to connecting, but it's worth taking a look in app/tmp/cache.
:-)
finally got it.... :-D
I forgot to assign the user access to my application's database on main server. After assigning the permissions all went fine.
Anyways thank you all for your valuable answers... It helped me gain some additional knowledge about cakephp.
Related
I have a code-first ASP.NET MVC app that ran smoothly and was able to access the data from SQL Server until I copied the project over to another location and opened it from there.
I get the following errors:
System.Data.DataException
HResult=0x80131501
Message=An exception occurred while initializing the database. See the InnerException for details.
Source=
StackTrace:
Inner Exception 1:
EntityException: The underlying provider failed on Open.
Inner Exception 2:
SqlException: Database 'C:\Users\BICHE\Desktop\FinalCSharpChallenge\FinalCSharpChallenge\App_Data\StudentContextDB.mdf' already exists. Choose a different database name.
Cannot attach the file 'C:\Users\BICHE\Desktop\MY REPOS3\The-Tech-Academy-C-Coding-Project\FinalCSharpChallenge\FinalCSharpChallenge\App_Data\StudentContextDB.mdf' as database 'StudentContextDB'.
My questions are: why does this happen just because I moved the project from my desktop to another location on my computer?
Can this be solved by making an "if" statement that proceeds to use the StudentContextDB if it exists, and creates it if it doesn't? (My instructor suggested this, so I'm thinking I will try this first)
Lastly, if this is the right solution, what would be the syntax for that particular statement? I've seen instructions for Drop and Create, but not Use or Create.
I appreciate any insight people may have on this issue!
SqlException: Database '...' already exists. Choose a different database name.
It looks like your code is trying to recreate the database... If this is a new deployment, you probably want a new database ; you should modify your code to have a database location which is relative to your application home directory.
The other advantage is that, if you give your application to other people, they will have their database created on their computer under the relative path defined by you, so that will play softly as well.
Short version here is that the db server still has a reference to the old location of the database. You moved it and tried to fire up the app and point to a new location of the database with the same name. The db server doesn't know how to handle that. It would be better to detach the database from the db server then move the files.
I get this error. The connection details in the wp-config file are correct. I have only been getting this error ever since I sent the website files to my boss to put the website online. I also did a dump of the database to send to him.
Is it at all possible that something he did effected my local copy of the wordpress website? It doesn't seem so...but I have only had this issue since he put it online. Maybe did I remove my database by mistake when I did the dump? Can I check that somehow?
Does a database dump mess up my database? I was the one that did the database dump, to send to him. Did it move my database?
Can I reinstall wordpress as a solution and copy my website into it?
Cheers.
Check if your live server database credentials match with details in your wp-config.
your localohost credential might be different from server credential
Secondly check if your boss has restored dump database
In my SSDT Project, why could I be getting this error?
"the select permission was denied on the object __refactorlog?"
There is a refactorlog item in the Project.
I select to generate a publish script from inside VS.
Edit: the target is a production server, so I don't have permissions to create tables or select data there, I just have to create the deployment script, and there is no table __refactorlog anyway..
You need greater permissions than you currently have on that server in order to generate a publish script. I verified that there is a call "SELECT OBJECT_ID(N'dbo.__RefactorLog')" in the code handling refactor operations that checks if the table exists. It's likely that the code is failing at that point as you don't have the permissions to even ask to select the object. You can check this yourself by running that query against the database and seeing if you get an error.
Suggestions for determining the permissions you need:
Try right-clicking on the database and choosing "Create New Project". If you can't extract the database definition to a project then it's a clear sign that you don't have View Definition privileges on the database
If that's not the case, then the issue is that you need read permissions on the __refactorlog table and don't have it. The solution would be to get access to that table, or else you'd have to verify none of the refactorings are needed and delete the refactorlog from the project (not recommended as generally you want to preserver refactorings to avoid possible data loss and other issues).
Here is how I handle this, even though it is a poor substitute and is not useful for automating database publishing. I write the publish script, then do a global search and replace, changing "dbo" to a schema that I can access. That works for me, because I have removed all the options that attempt to script objects I do not control, and the dbo schema is completely out of my hands, same as you.
I am not proud of this, and I wish that I had the option of controlling where that table could reside, but at least the Visual Studio features of refactoring are completely supported.
I have a problem with Cpanel, or atleast with my database, because i cant see my database trough either cpanel,mysql databases or phpmyadmin but when i tried to run a import sql script it states that the database exists. How can i access my database, i have heard some databasemapping resets on cpanel level but the problem is that i cant access the server on any way(only my site via FTP ofcourse).
It looks like i dont have permission, also my firstly created (head mysql account) is gone, or atleast i cant login with the same credentials as before. Whenever i try to add an mysql user it says completed(user created succesfully) but when looking at all users there aren't any users stated.
Sounds strange doesn't it?
I hope someone knows the answer, i need the database back.
You can use Adminer for importing and exporting data via ftp. Please try.
I am receiving this error message while creating DB from a .mdf and .ldf files located on a network drive.
Query executed:
create database DatabaseName ON
(FileName = '\\gyancluster-sql\g$\Backup\WSS_Content_DB.mdf'),
(FileName = '\\gyancluster-sql\g$\Backup\WSS_Content_DB_log.ldf')
for attach
GO
Error
The file "\gyancluster-sql\g$\Backup\WSS_Content_DB.mdf" is on a
network path that is not supported for database files.
So what is your problem? What is the question? No question there - just dumping a sentence ;)
I mean, without wanting to sound too sarcastic, but you CAN read, or?
The file "\gyancluster-sql\g$\Backup\WSS_Content_DB.mdf" is on a network path that is not supported for database
files.
That is pretty clear, isn't it? It is not supported - for VERY good reasons, btw., until now.
Are you asking us now whether MS lies? No, they do not lie - this is not supported. They REALLY MEAN what they say.
There are ways around (http://support.microsoft.com/kb/304261) but that is it ;)
Do you want us to reword the error message? Maybe into "dude, that wont worx, not cool, see"? Clearer?
Seriously - soudns harsh, but I always wonder why people do not actually READ the error message.
Use DBCC TRACEON(1807) before trying to create the Database.
Also, you can add the linea "-t 1807" to the MSSQL server startup parameters, it will make the change permanent. The command above let you use network storage, but on a reboot you will lose the flag.
You are lucky that the OS is warning you that opening database files directly over a network is a bad idea. Older database api's let you do that with no warning and then network users of that database application are forever blighted with corrupt databases.
If \gyancluster-sql\g$ refers for Local Disk G on the computer gyancluster-sql which also happens to be where the sql service is running, then you really should be using
create database DatabaseName ON
(FileName = 'G:\Backup\WSS_Content_DB.mdf'),
(FileName = 'G:\Backup\WSS_Content_DB_log.ldf')
for attach
GO
Note this remains true even if you are running the script from another computer.
It would still be a bad idea, but you may able to use the UNC names, but only if the service under which sql is running is able to access the share(eg if running under the Domain Administrator account), but that is normally considered an unnecessary security risk.
If you are really trying to store the database on network device, then obviously that means the sql service does need access to the share, so that would be the first thing to check, but you also need to read the Microsoft article which Chris Dickson has pointed you to (ie http://support.microsoft.com/kb/304261) which details when this is supported.
You need to enable the database file over network shared, the following post explain step by step how to do it.
https://blogs.msdn.microsoft.com/varund/2010/09/02/create-a-sql-server-database-on-a-network-shared-drive/
The same post explains the risks to do it.
I hope this helps
Regards