9022 SQL ERROR while executing CREATE DATABASE query through .net code - c#

When i try to execute CREATE DATABASE query from .net code,
"CREATE DATABASE TESTDB_RE ON (NAME=TESTDB_RE_dat, FILENAME='D:\Test.mdf', SIZE=4MB, FILEGROWTH=4MB) COLLATE Latin1_General_CS_AS;"
I am getting error
"Detail=[9022],Msg=[The log can not be initialized because the log files are not fully formatted. Database 'TESTDB' cannot be opened due
to inaccessible files or insufficient permission" error.
I checked microsoft documentation for 9022 error but not getting sufficient information for the cause of 9022 error.
Any help would be higly appreciated. Thanks.

Related

Query execution failed for dataset. (rsErrorExecutingCommand)

I've developed few reports. More of them are working fine in develop environment. after successfull testing they were published on web. But one of them if I press "View Report" following error occurs.
An error has occurred during report processing. (rsProcessingAborted)
Query execution failed for dataset 'xxx'. (rsErrorExecutingCommand)
For more information about this error navigate to the report server on the local server machine, or enable remote errors
My dataset result doesnt get. I changed my sp result and it solved it. Maybe this help someone.
Thank you

Sending SPARQL queries from C# using stardog: "cannot execute update query on read endpoint"

as the title says i'm trying to create triples using SPARQL queries from visualstudio. Using the same SPARQL queries inside stardog studio works, but when i try to send them from visualstudio using the stardogconnector i get the following error:
An unhandled exception of type 'VDS.RDF.Query.RdfQueryException' occurred in dotNetRDF.dll
Additional information: A HTTP error (HTTP 400 Bad Request) occured while querying the Store.
Store returned the following error message: {"message":"Cannot execute update query on read endpoint"}
See aforementioned status line or inner exception for further details occurred
Here is the code:
StardogConnector stardog = new StardogConnector("http://localhost:5820", "dbtest", "admin", "password");
stardog.Begin();
string query = "INSERT DATA { <http://example/book1> dc:title \"test\"}";
stardog.Query(query);
stardog.Commit();
As i said, inserting the same query inside stardog studio gives the right result. The database is online, the connection works (password etc. is correct),...
I just don't know what the error means. Can anybody help? I don't find much online about this error.
When query includes INSERT, UPDATE, or other write action, you have to change stardog.Query(query); (which is read-only) to stardog.Update(query); (which is apparently write-only).
It appears that dotNetRdf sends all queries to the /myDb/query endpoint, however as of Stardog 5.x all SPARQL update queries must instead be sent to the /myDb/update endpoint. Official Stardog tools (Studio, stardog.js, etc.) were updated at that time.
Feel free to direct any other questions over at community.stardog.com.

Unable to execute Stored Procedure through SSMS and VS

I have a stored proc which just updates a table and I am executing it through C# code as well as through SSMS. Whenever i execute it, I get the following error:
Login failed for user domain\username
I have given full permissions to the SP and have also recreated the SP, but still I get the error. Strange thing is, all other procedures are working fine from both C# code and SSMS. I have also provided sysadmin access to my ID - still no luck.
While executing from VS (C# code), the connection opens but getting the same exception (SQLException).
Can anyone please tell me how to resolve this error?
Thanks Gregg for your suggestion. I have fixed this error. The problem was with the underlying tables the procedure was using and I have dropped and created those tables. Bingo.- it worked.
Looks strange but this is how I fixed.

First chance exception of 'System.Data.EntityException'. The underlying provider failed on Open

I've been given a site that was created by someone else and I'm now trying to test it. I can compile the system without any problems but when I try to log in to the website, I get the error:
"EntityException occured. A first chance exception of type 'System.Data.EntityException' occured in System.Data.Entity.dll. Additional info: The underlying provider failed on Open."
Furthermore, if I dig deeper, I see an InnerException of Cannot open database \"MyDB\" requested by the login. The login failed. Login failed for user 'name\\owner'.
I've read similar problems on the web and it seems like its a problem with database connections? I've tried multiple 'solutions' that include messing around with the connectionString but nothing works.
What I think the system wants to do is connect to a .mdf located in a separate project's App_Data. Anyway, here's the connectionString code that I received originally:
add name="NameServiceContext"
connectionString="Server=tcp:qiu5vg5yhv.database.windows.net,1433;Database=MyDB;User ID=MYID;Password=MYPASS;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;"
providerName="System.Data.SqlClient"
Quick question, what is the tcp:...... stuff? I'm assuming it was generated somehow, but how?
I've tried 'fixing' the problem and ended up with something like this:
add name="NameServiceContext"
connectionString="data source=./SQLEXPRESS;AttachDbFilename=C:\Users\owner\Documents\MyERP\App_Data\MyDB.mdf;Integrated Security=True;Connect Timeout=30;"
providerName="System.Data.SqlClient"
Both methods give the same errors and I'm out of ideas. How would I go about fixing this?
Also, when I connect to a db via tools>connect to database > MS SQL db file, I get an option between 2 data sources, ./SQLEXPRESS and (LocalDB)\v11.0. Do I have to include both of them? If so, how?
The original connection string refers to a Microsoft Azure instance. A typical connection string to Azure looks like:
Server=tcp:[serverName].database.windows.net;Database=myDataBase;User ID=[LoginForDb]#[serverName];Password=myPassword;Trusted_Connection=False;Encrypt=True;
Your server name is qiu5vg5yhv.database.windows.net. Most likely your credentials are incorrect.
It is as Andrew said, you don't seem to have access to the actual database. Simply download either "SQL Server Management Studio" or "SQL Server Management Studio Express" (depend on which version of database you are using) and try to connect.
If you connect successfully, check if you can query the database of your project.
If you connect unsuccessfully, contact your system admin to arrange access.
If you want to understand more about connectionstring or create one, use the following site for template: http://www.connectionstrings.com/sql-server/
You can get the necessary database details by viewing the Properties of your database via "SQL Server Management Studio" (right click and select Properties --> View Connection Properties)
I met the same question. The key step is here.
I used vs 2013 update 4.
When you configured your SQL in azure, it generated a connect string.

Schema specified is not valid. Errors: error 0002: Request failed

I have an EntityFramework project running off MySql that runs great locally as well as on a dedicated server, however I'm trying to move this project to HostGator and I'm receiving the following error:
Schema specified is not valid. Errors:
App_Code.WireWeld.ssdl(2,88) : error 0002: Request failed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.MetadataException: Schema specified is not valid. Errors:
App_Code.WireWeld.ssdl(2,88) : error 0002: Request failed.
I know the database is correct as I can connect via Navicat and see its contents. I'm pretty sure the connection string is correct, I have the proper username and password.
I'm really stuck on this one and would appreciate any help possible.
If you are using more than one model in your project I advice you to have a look into that topic as it describes possible solutions to the problem.
If you are not using multiple models than this looks like a file permission issue to me.
Perhaps in the hosted environment, the account underwhich your application is running doesn't have access to where the metadata files are located?
You should make sure you have permission (read/write are required). If this is not an option for you than the only go would be to embed the metadata in the assembly directly and use a res:// style connection string.
If you're using SQL server and have 2 projects - one is a class library and the 2nd one uses that class library in main project, then place both dll from class library project to main project refrence.
1-EntityFramework.dll
2-EntityFramework.SqlServer.dll

Categories