I have two databases; one is in local server;
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
PL/SQL Release 11.1.0.7.0 - Production
"CORE 11.1.0.7.0 Production"
TNS for 64-bit Windows: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - Production
The other one is a VM :
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
"CORE 11.2.0.4.0 Production"
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production
Everything else about these servers are identical.
I am DBA for both of the servers. All the tables and stored procedures and are working fine in both databases but one stored procedure is not working when Asp.net tries to connect to it.
When I run my Asp.net app that is connecting to the VM database I get the following error telling me that stored procedure must be declared :
Message: Sys.WebForms.PageRequestManagerServerErrorException: ORA-06550: line 1, column 7:
PLS-00201: identifier 'GETINFO' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
I open my SQL Developer and debug the procedure on the VM database and I get the desired values.
It is only happening in .Net app if I try to get that particular stored procedure. Everything else, being all the other stored procedures, are working fine.
What I have done to fix the issue;
Changed the name of the procedure (didnt work)
Checked the schema to make sure all the tables and stored procedures belongs to correct user (they do belong to correct user)
I granted access to user even though stored procedure created by that user.
I dropped and recreated stored procedure
I used Myuser.storedprocedure name notation it didnt work
What I don't understand is that exact same code is working on local network, and also that I can debug the stored procedure via Oracle SQL Developer.
I can share the stored product here but it is really, really long.
How can I fix this?
You are getting this error because of insufficient permission to execute the stored procedure. Try to grant permissions at the user level (user level means through which credentials you are connecting to the database. Check in your config file).
I got the same issue. I created a stored procedure in Oracle DB. I executed, it compiled successfully. But, it was getting issue at runtime. After granting permissions at user level for the stored procedure then the issue resolved completely.
Run-time Exception ORA-06550: line 1, column 7:
PLS-00201: identifier 'Package.StoredProcedure' must be declared
ORA-06550: line 1, column 7: PL/SQL: Statement ignored
Check your connection string and make sure that you are calling correct database and/or schema name from C# application.
If all the other stored procedures are working fine and this specific one not working fine when you debug on oracle sql developer; it must be connection issue. If it debugs and work on both databases under DBA account there should be no permissions issues as well.
I think if you focus on connection as mmmmmpie said in his comment, you should find the issue.
I got this error when a stored procedure was changed in the database.
The script used for update the changes started with:
PROCEDURE myProcedure
By adding the following lines:
CREATE OR REPLACE myProcedure
Solved this error. In my case, maybe this error didn't show at first because it was a new stored procedure.
i got this issue when i was working with oracle and Asp.net MVC.
I was used store procedure.let me give you a in brief
we have two databases in oracle
eg. Reportdatabase, Productiondatabase
I was created store procedure on Reportdatabase and
also we have 2 connection in my web application eg: connection1, connection2
by mistakenly I was called connection2 Productiondatabase but query was
prepared on connection1 database so that some tables are not getting to Store procedure that's why I was getting this error
Related
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.
I am about to deploy my application and have came into a bit of trouble.
I have the connection string for the database held in the application.settings and need a way to check if the database exists when the program first starts up, and if it doesn't, i need the program to create it before starting the program.
I am assuming it would be a mysql statement to check if db exists, if not create. However, I don't know where or how to do this, can I create a mysql dump of a blank database with tables etc already created and use that?
I have already stored the mysql dll files locally so there is no problem with that, its just creating the database that the string wants to connect to before the application runs so there are no connection errors straight away.
Thanks.
You can do this by running the following SQL statement:
SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = "my_db"
If it doesn't exist from the result set you get returned you can then create it.
This does pose questions regarding MySQL permissions and if your application should have user rights that enable such checking.
Edit in response of comments.
It isn’t clear if you create the connection string or not – I’ll assume the worst and that it is a part of the setup so your client can enter it (if you do know it the process below simplifies.
I would pass the connection string to the constructor of the MySqlConnectionStringBuilder class, this then makes it easy to connect to the database using the MySqlConnection class. I would use the properties from the new instance of the MySqlConnectionStringBuilder class (Server, Host, User etc) to setup the MySqlConnection class.
If the connection didn’t work I would return information to the user and they can update their connection string.
Once I’ve successfully connected to the database I would then use the database name from the Database property of my MySqlConnectionStringBuilder instance to build the query above.
If the command returns NULL the database doesn't exist and then needs creating, if the database does exist then the command will return the name of the database.
Now there are two paths:
It Doesn't exist – It needs creating, I would probably have an external SQL file with the create statements in (can be produced by MySQL dump by using the –nodata option). I would parse this file and execute the create statements
It does exist – I would now check the structure of the database to make sure it is compatible before continuing the installation.
I am connecting to a Sybase 9 database to retrieve data. I can query the database without issue using ODBC connections but I am having an issue calling stored procedures. The procedure was written probably 6-7 years ago. This is what I have to execute the stored procedure.
OdbcCommand itemWeightAve = conn.CreateCommand();
itemWeightAve.CommandText = "ComputeLastCost";
itemWeightAve.CommandType = CommandType.StoredProcedure;
itemWeightAve.Parameters.AddWithValue("#OwnerId", "BananaHammock");//company number
itemWeightAve.Parameters.AddWithValue("#InventoryId", InventoryNumberHere);//inventory id from query results
itemWeightAve.Parameters.AddWithValue("#EndDate", EndDateHere);//end date from query results
OdbcDataReader itemAveReader = itemWeightAve.ExecuteReader();
I am not very familiar with Sybase or ODBC and the version these guys are using is extremely old and is no longer officially supported. Upgrading the Sybase database is out of the question. The error I get when attempting to execute this command is...
ERROR [42S02] [Sybase][ODBC Driver][Adaptive Server Anywhere]
Procedure 'ComputeLastCost' not found
I know that the procedure exists, it is typed correctly, and that the parameter names exist and are typed correctly. Does anyone have any tips/hints/suggestions for what I'm doing wrong here?
Turned the comment into an answer...
What is the default database of the login that you are using?
Is the stored procedure in the same database?
If not, you need to prefix your procedure name with the database name "sharedDB.ComputeLastCost".
You can check this by logging in with the same user/password through isql and try and exec it by hand. if you have to do a use database (ie. use database sharedDB) before you execute it, you need to put the db name in front.
You can also change your default database for the user. Either way should work.
I'm having a problem:
I have a db connection where I run stored procedures on. This same connection is used to create said stored procedures earlier on.
When I attempt to call a given stored procedure, later on, I get the following message:
Could not find stored procedure
'dbo.yaf_prov_upgrade'.
The problem is it actually does exist on the database. And there's also the fact that it shows up on the SQL Server Profiler.
RPC:Completed exec
[dbo].[yaf_prov_upgrade]
#PreviousVersion=46,#NewVersion=46 .Net
SqlClient Data
Provider Nico Matrix\Nico
I was wondering what could be the causes a particular query would throw such an exception even when it exists, it's called, and the call reaches the database.
It can't be a problem with the connection because it already executed other stored procedures. It can't be a problem with the procedure because it does exist, in fact the very same application, the very same web page, created it and put it there.
Update: forgot to mention I'm used integrated security, and I did run the SP on the database with the same user the application connects with, and I had no problem running it.
So what can it be?
Your RPC completed only means that the batch submitted to SQL Server was correct and completed. It doesn't mean the stored procedure ran and executed OK.
It will be (don't argue, check) one of:
wrong permissions
wrong database context
wrong server
stored proc is in a different database
To ensure that things are the same
SELECT
##SERVERNAME,
SUSER_SNAME(),
DB_NAME(),
USER_NAME(),
OBJECT_ID('dbo.yaf_prov_upgrade')
The OBJECT_ID will be NULL if the stored proc doesn't exist in that database or you don't have permissions.
I suspect it might be a permissions issue, check up if the user name your program is executing under has execute rights to the stored proc.
I'm no expert by far on ms-sql, but I do know it keeps SPs in a global cache. Is it possible the local connection only gets the global list of SPs upon connection? Maybe reinit the connection or re-select the cache?
I'm guessing Visual Studio is bugging out on me. I changed the stored procedure the a TableAdapter query uses and now the users keep getting the following error.
Procedure or function 'usp_GetEventNotificationSubscribers' expects parameter '#FacilityCode', which was not supplied.
Nowhere in the application is 'usp_GetEventNotificationSubscribers' written.
I can't reproduce the error on my local machine. When I run it locally or step through it in debug mode everything works fine. It even works for me in production. But I keep getting them auto-emailed to me whenever it happens, which is about 3 a day.
Is the proc being referenced from another proc in the database? If this is so, you won't find the string in your application source code.
try this:
SELECT * FROM SYS.Comments
WHERE text LIKE '%GetEventNotificationSubscribers%'
Is the stored procedure different (e.g. with different parameters) at the production site? It might be that the proc was updated/altered there and locally at your dev environment you're working with a different procedure. This error seems to suggest that the proc in the sqlserver db at the production site has more parameters than the one at your development database.
A few users where still using the test version of the site. I denied access to everyone on the test virtual directory and the error ceased.
Thanks Noel