DatabaseMetadata Methods With Catalog Parameters Now Error If Current Database Does Not Match.
May 11, 2007
In the v1.2 CTP version, the DatabaseMetadata methods for getting information about objects in a database (i.e. getTables(), getColumns(), ...) errors if your current database connection is in a different database than the object you are quering.
Is this the intended behavior going forward?
In my case I have access to both database A and database B. My current connection is in database A , but I am looking up object in database B.
[junit] The database name component of the object qualifier must be the name of the current database.
[junit] com.microsoft.sqlserver.jdbc.SQLServerException: The database name component of the object qualifier must be the name of
the current database.
[junit] at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
[junit] at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source)
[junit] at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(Unknown Source)
[junit] at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(Unknown Source)
[junit] at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
[junit] at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
[junit] at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)
[junit] at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source)
[junit] at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeQueryInternal(Unknown Source)
[junit] at com.microsoft.sqlserver.jdbc.SQLServerDatabaseMetaData.getResultSet(Unknown Source)
[junit] at com.microsoft.sqlserver.jdbc.SQLServerDatabaseMetaData.getResultSet(Unknown Source)
[junit] at com.microsoft.sqlserver.jdbc.SQLServerDatabaseMetaData.getColumns(Unknown Source)
I got the following error msg last night, in fact running anything in a query window. My solution was to stop and restart the SQLServer, but not ideal in a production environment. Anyone know what the cause/solution could be?
TIA, Neil
sg 910, Level 17, State 1 Could not allocate a new object descriptor for required system catalog in database '1'. Another database must be closed or objects in another database dropped in order to open this database. Msg 2812, Level 16, State 4 Stored procedure 'sp_who' not found.
public DataSet EeoReport(DateTime start, DateTime end)
{}
i want to know how to send the date time parameters to this from RS using XML data source.
basically i need the <Query></Query> XML used to make this happen. So far i'v eonly been able to statically create parameters, but that does me no good, i want the users to be able to pick a date range from RS dynamically to get the report.
After detaching the database I placed the database files and log files in the D folder as C drive was full. When i try to attach the files I am getting an error Failed to attach database Microsoft SQL Error 7622 (QCFTCAT Full text catalog).
I checked there is a folder in C drive by name QCFTCAT and the C drive has no space. What does this folder means please let me know on the same.
After detaching the database I placed the database files and log files in the D folder as C drive was full. When i try to attach the files I am getting an error Failed to attach database Microsoft SQL Error 7622 (QCFTCAT Full text catalog). I checked there is a folder in C drive by name QCFTCAT and the C drive has no space. What does this folder means please let me know on the same.
I'm having a problem getting back appropriate metadata for storedprocedures from MS SQL Server 2000 and 2005.I've created a simple stored procedure that has an output param thatis a cursor.When I ask for the metadata for that stored procedure using a JDBCdriver I get back a datatype value for my parameter specifying an intnot a result set.Here is my stored procedure:CREATE PROCEDURE xasp_INx_OUTcur_RETint@OutCrsr CURSOR VARYING OUTPUT ASSET @OutCrsr = CURSOR FORSELECT LASTNAME, FIRSTNAMEFROM CONTACTS2OPEN @OutCrsrRETURN 7Here is the java code:Connection conn = driver.connect(url, props);DatabaseMetaData dbMeta = conn.getMetaData();ResultSet columnRes = dbMeta.getProcedureColumns(cat, schem, name,"%");while (columnRes.next()){String procCat = columnRes.getString("PROCEDURE_CAT");String procSchem = columnRes.getString("PROCEDURE_SCHEM");String procName = columnRes.getString("PROCEDURE_NAME");String colName = columnRes.getString("COLUMN_NAME");short colType = columnRes.getShort("COLUMN_TYPE");short dataType = columnRes.getShort("DATA_TYPE");String typeName = columnRes.getString("TYPE_NAME");int precision = columnRes.getInt("PRECISION");// pass this info on to another method}The dataType is set to the type returned from the procedure not to thetype for the param.Am I doing something stupid here? Did I create my stored procedurewrong?Any help would be appreciated.Thanks.Jon
I used a backup copy of our production DB (residing in our prod machine) to do a database RESTORE to our test DB (residing in our test machine). This step was successful. However when I tried to access the test DB via Peoplesoft application, I am unable to logon. Only then did I notice that all the users, with the exception of "sa", were gone. When I attempted to add a user via Enterprise Manager's Action - Add Database User, I get the message, "Error 15023: User or role '%' already exists in the current database. What's the best way to fix this without resorting to copying the source server's master database (If i do this, I risk clobbering some other DB's that are present in the target server but not in source server)? Any help you can provide will be greatly appreciated!!!
We replicate a SQL2000 database (DataBaseA) to a SQL2000 database (DataBaseB) by using the Restore function and hasn't change its logical name but only the physical data path and file name. It is running fine for a year. We use the same way to migrate the DataBaseB to a new SQL2005 server with the Restore function and the daily operation is running perfect. However, when we do the Backup of DatabaseB in the SQL2005, it just prompt the error message
System.Data.SqlClient.SqlError: The backup of full-text catalog 'DataBaseA' is not permitted because it is not online. Check errorlog file for the reason that full-text catalog became offline and bring it online. Or BACKUP can be performed by using the FILEGROUP or FILE clauses to restrict the selection to include only online data. (Microsoft.SqlServer.Smo)
Please note we left the DataBaseA in the old SQL2000 server.
Please help on how we can delete the Full-text catalog from DatabaseB so we can do a backup
I have a compact pc program that uses a sql server database (sdf file). I want to check the database integrity when program starts so I added a call to veriy method of SqlCeEngine.
The verify function always returns false even the database is OK and I can work with it.
when I call repair it throws the exception : "The specified module could not be found"
"SSIS 2012 Catalog doesn't have option to give read access to SSIS Catalog to view package run reports" ... Any luck allowing power developers / operators access to READ the SQL 2012 SSIS Execution Reports without granting them SSIS_Admin or Sysadmin?
According to this link posted back in 2011 (w/ Microsoft's feedback in Nov 2011: "We’re closing this issue as “Won’t Fix.” At this point the bug does not meet our bar for resolving prior to SQL Server 2012 RTM. As we approach the SQL Server 2012 release the bar for making code changes gets progressively higher." URL....Regarding Permissions to SSIS Catalog, here are the findings. We can give access in three ways:
1. READ Access – We can provide a user db_datareader access. With this the user can see the objects within the SSIS catalog database, but cannot see the reports.
2. SSIS_ADMIN – Add the user to this database role in SSISDB. With this the user can view the reports. But it also provides them privileges to modify catalog information which is not expected. We can add it using below script EXEC sp_addrolemember 'ssis_admin' , 'REDMONDPAIntelAnalyst'
3. SYSADMIN - Add the user to this server role. This will make the user an admin on the SQL server. This is not intended. Is there any method available which will have provision to give read only access to see SSIS Catalog package execution reports and not having modify Catalog access.
I am in the process of implementing database mirroring. I am trying to get an understanding about manageable ways of keeping sql user logins synced between instances.
I have looked at KB918992 which makes sense for the initial intallation, but what about keeping passwords synced in the long-term. I don't want to have to manually set a users password on the failover every time they change it.
How is everyone else accomplishing this using sql logins (not windows auth)? Pointers to articles and/or documentation would be great.
As stated in the subject I have a situation where if database mirroring is employed for either manual or automatic failover, all the client (including web connections) connections use ODBC not ADO, or OLEDB etc... so what methods are recommended? Client side redirect is not available so I could not employe the "Data Source =A; Failover Partner=B..." option.
Right now the method employed (pre database mirroring and basically employing log shipping on SQL 2000) is to have a DNS alias for the ODBC connection so that if the server were to change in a failover situation the DNS record would have to be altered, so that all the client connections would not have to be reconfigured.
I have a SSRS report using 2008 R2. It prompts the user for the start and end dates. This all works. But now I want the start date parm to default to the first day of the current month and the end date parm to default to the last day of the current month.In the new query window in SQL Server Management Studio, I can run this chunk of code to get the first day of current month:
I have an ssis package that downloads a SQL Server 2000 database and restores it to a SQL 2005 server. Ninety-five percent of the time it runs just fine, but every so often the job fails and I get the following set of error messages in the log file. (I have had to delete some of the proprietary information for this message to satisfy my boss like putting in [Database name] in place of the actual name of the database in the error message).
OnError, Restore backup file to DB,,,1/6/2008 2:59:31 AM,1/6/2008 2:59:31 AM,0,0x,Converting database [Database name] from version 539 to the current version 611. OnError,1/6/2008 2:59:31 AM,1/6/2008 2:59:31 AM,0,0x,Converting database [Database name] from version 539 to the current version 611. OnError,Restore backup file to DB,,,1/6/2008 2:59:31 AM,1/6/2008 2:59:31 AM,0,0x,Database [Database name] running the upgrade step from version 539 to version 551. OnError,1/6/2008 2:59:31 AM,1/6/2008 2:59:31 AM,0,0x,Database [Database name] running the upgrade step from version 539 to version 551. OnError,Restore backup file to DB,,,1/6/2008 2:59:31 AM,1/6/2008 2:59:31 AM,0,0x,The transaction log for database [Database name] is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases OnError,1/6/2008 2:59:31 AM,1/6/2008 2:59:31 AM,0,0x,The transaction log for database [Database name] is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases OnError,SQL5,1/6/2008 2:59:31 AM,1/6/2008 2:59:31 AM,0,0x,RESTORE could not start database [Database name]. OnError,SQL5,1/6/2008 2:59:31 AM,1/6/2008 2:59:31 AM,0,0x,RESTORE could not start database [Database name]. OnError,SQL5,1/6/2008 2:59:31 AM,1/6/2008 2:59:31 AM,-1073548784,0x,Executing the query "RESTORE DATABASE [Database name] FROM DISK = '[Path to back up file]' WITH REPLACE, MOVE 'ASP_Live_Data' TO [Path to MDF file], MOVE 'ASP_Live_Log' TO [Path to LDF file]" failed with the following error: "RESTORE DATABASE is terminating abnormally.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. OnError,1/6/2008 2:59:31 AM,1/6/2008 2:59:31 AM,-1073548784,0x,Executing the query "RESTORE DATABASE [Database name] FROM DISK = '[Path to backup file]' WITH REPLACE, MOVE 'ASP_Live_Data' TO [Path to MDF file]', MOVE 'ASP_Live_Log' TO [Path to LDF file]" failed with the following error: "RESTORE DATABASE is terminating abnormally.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. OnTaskFailed,Restore backup file to DB,,,1/6/2008 2:59:31 AM,1/6/2008 2:59:31 AM,0,0x,(null)
I downloaded and ran AdventureWorks.msi into my SQL Server Management Studio Express (SSMSE) one year ago.But I did not know how to attach it to my SSMSE then. Last week, I deleted it from the "Add or Remove" of Control Panel and I downloaded the new AdventureWork.msi and installed it my SSMSE. Today, I tried to use the Database Explorer of VB 2005 Express for the first Stored Procedure programming. I clicked on AdventureWorks.mdf and I got the following error: One or more files do not match the primary of the database. If you are attempting to attach a database, retry the operation with the correct files. If this is an existing database, the file may be corrupt and should be restored from a backup. Cannot open user default database. Login failed. Login failed for user 'CENADe1enxshc'. Log file 'C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDataAdventureWorks_Data_log.ldf' does not match the primary file. It may be from a different database of the log may have been rebuilt previously. Please help and advise me how to correct this problem.
I downloaded a copy of sql server and when I run the following query in the sql management studio after choosing new query , DMX I get the above error
CREATE MINING MODEL [NBSample]
(
CustomerKey LONG KEY,
Gender TEXT DISCRETE,
[Number Cars Owned] LONG DISCRETE,
[Bike Buyer] LONG DISCRETE PREDICT
)
Using Microsoft_Naive_Bayes
Also in the pane Mining Model I get the message No mining models found. The only error I get when I installed SQL server was a COM plus registration error. I am running Windows XP SP2. Can someone please help.
I need to develop a strong licensing solution based on the database accessed... Currently our solution is easily hackable because the the license information is kept in the database of your choice and is not dependant on some static information, the current encryption key is static and kept in the software so it can be hacked easily. What i want to do to change this is simple in nature but i don't know how to get that one particular info i need. I want to get some kind of unique identifier for a database (catalog) that sql server could generate. This info must be static and must not be movable. If for example, someone would backup and restore, this information would not be transfered with the backup. Thus, a user that backups his database and restores it on another database server or another database catalog even on the same server would corrupt his license since the Unique ID returned by the SQL Server would be different; the hashing code would change and thus the decryption would fail. Is there any such info i can query using SQL that will not require admin rights?
I need advice on my design. I'm developing a system that track the catalog distribution.
I have a 5 table. Company Table - Store list of company. Each company can have many staff.
Staff Table - Store list of staff.
Catalogs Table - Store list of catalog. Each catalog can have many revision. PKEY id name latest
CatalogsRev Table - Store list of catalog revision. PKEY catalogID -> Catalogs.id PKEY year
Staff_Catalog Table - Each staff can have many catalog revision. PKEY staffID -> Staff.id PKEY catalogID -> CatalogsRev.catalogID PKEY year -> CatalogsRev.year
Is the above table good enough to track which company do not have latest catalog revision?
For the Catalogs Table should I use a trigger to update the Catalogs.latest column everytime a new CatalogsRev is entered? I've read some article on the web says trigger is slow, but in my situation is it suitable to use trigger?
While attempting to query a Full-Text enabled database where a catalog exists for the database, I receive the following error: "Full-text catalog %database% is in an unusable state. Drop and re-create this full-text catalog." I have dropped and re-created the full-text catalog numerous times with no luck. I have also stopped and restarted the SQL Server service and Full-Text service engines mulitple times with no luck. Other items to note are, we're running SQL 2005 64 bit Enterprise Edition SP1 on a Windows 2003 server. We have an identical setup in development and full-text indexing works without any hitches. I have also checked both the SQL server permissions and the local file-system permissions and they also seem to be more then adequate; in addition, they match the security configurations of our development environment. Lastly, the production database is a restore of the development database.
In short, I'm hoping that someone may have a potential solution other then reinstalling SQL Server...which may end up being the only solution.
Im trying to register my CLR UDF in SQL 2005 using this code CREATE FUNCTION GetSomething() RETURNS INT AS EXTERNAL NAME MyAssembly.MyFunction.MyMethod When I run it against my DB I get this error: Assembly MyAssembly was not found in the SQL catalog of database MyDB Ive successfully registered my custom assembly in the DB (I see it under Assemblies folder), and Ive set CRL Enabled to 1 in my DB. What am I doing wrong? Thanks in advance
I use an "SQL task" to run a stored procedure (SP) to bring me an XML as resultset. The SP generates an XML using "XML EXPLICIT".
When I run my package from my Visual Studio (at my PC) I get a clean XML that I am capable of traversing. I was very happy....but when I schedule a job on my server to run this package, I get : ERROR: End tag 'Doc' does not match the start tag 'D彈Ӏęoc. Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly'. (I had to add a log provider to catch this).
Why is getting a start tag with invalid characters, thus causing to fail my package?
Does it have to do with the regional settings on my PC/Server?
I have a flatfile source with qty,title and author..i add a lookup and in that i establish relation between title and titel of pubs database..but i am getting an error.. one or more columns do not hav supported data types,or their datatypes do not match..i checked both hav dt_str,and in database pubs title is varchr..so why this eror?
Scenario: Launch SQL Server 2005 Management Studio & Connect to Server, ie: ServerNameInstanceName. Click "New Query" Button
Running the following SQL Statement returns 842 rows but should return 1343:
SELECT A.id, C.PName, B.School FROM users AS A LEFT OUTER JOIN Bio AS B ON A.id = B.id LEFT OUTER JOIN Groups AS C ON A.PName = C.PName ORDER BY A.Id
I get 1343 rows when I change Line 2 of SQL Statement to: "FROM dbName.dbo.users AS A".
Clicking "New Query" w/out first opening the database must run the query in the context of the Master Database?? I noticed in Sql Server 2000 if I connect Query Analyzer to the Server and run the query I get 842 & I can see that the default selected database is master. When I make the change mentioned above I then get 1343.
Why doesn't this produce an error though? I'd rather get an error than the wrong result set.
I am currently designing an adp front end that links to a Sql Server database.
In terms on front end upgrade prespective i am thinking about a logon routine procedure ( which should be a vba code code that runs at startup) to check wheter the adp front end which is being used is the latest release hence compatible with the database current version.
Create and manage version number at back end level is quiet easy however to set a version number or whatever else information in the adp is somewhat a big hassle as database properties are not available from visual basic when using adp.
Was also thinking about using my xml file which holds my configuration information such as Data source - catalog but that's mean deployment of new front end must be carried out with local xml file change.
Also any manual update of information about version in xml file could allow old front end to run with database.
Please any tips and advises on how to handle this issue highly appreciated.
I am using the following views from two db's to find records that don't match.
My question is can I have output of fields from the second table
SELECT distinct T1.[last name],t1.[first name],ENum FROM ECLINICIAN_Info T1 WHERE NOT EXISTS(SELECT * FROM ACLINICIAN_Info T2 WHERE t1.Enum = t2.Anum and t1.[last name] = t2.lname and t1.[first name] = t2.Fname)
Can someone please answer a problem that I've run into. I know that it's probably something stupid. I keep getting this error:Server: Msg 107, Level 16, State 3, Line 1The column prefix 'vFirstTimeEntered' does not match with a table name or alias name used in the query.Here is my query:-----------------------------------------------------------------Update TimeSheetSectionSet TimesheetSection.SECSTARTDT = vFirstTimeEntered.schlstuidWhere timesheetsection.schlstuid = vFirstTimeEntered.schlstuid AND timesheetsection.sectionid = vFirstTimeEntered.sectionid AND Timesheetsection.secstartdt < '2005-08-01'------------------------------------------------------------------vFirstTimeEntered is a view that I created.Do I need a sub query? I know that if this was a select query I'd need to put vFirstTimeEntered in the FROM part but I don't know where it should go here.Thanks for any assistance.Scott
I have a table names Alert_Event and a new column named BSP_Phone has been added to the table. I am trying to set NULL values to the column and I get the below error. I am setting null values in the bolded text in the query.
Error Message:
Msg 213, Level 16, State 1, Procedure SaveBSPOutageInfo, Line 22 Column name or number of supplied values does not match table definition.USE [gg] GO
/****** Object: StoredProcedure [dbo].[SaveBSPOutageInfo] Script Date: 10/17/2013 19:01:20 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[SaveBSPOutageInfo] @eventCreatedDate DATETIME, @eventOrigin varchar(10),
Guys,1st of all.. sorry about my english ok? Im from Brazil...Im trying to get a RS connecting through 2 databases with the querybelow:SELECTscar..osbalcao.numeroos,ccell.dbo.atrib_os.osFROMccell.dbo.atrib_osJOIN scar.dbo.osbalcao on ccell.dbo.atrib_os.os =scar.dbo.osbalcao.numeroosWHERE scar.dbo.osbalcao.localprod = '257'AND scar.dbo.osbalcao.status in ('EM')On a SQL IDE i got a good RS, but, when i try to use that same query onDelphi + ZEOS, the SQL Server tells me that "The database namecomponent of the object qualifier must be the name of the currentdatabase".I really dont understand why. I can only tell that the error isreturned from SQL Server.Have anyone got the same trouble?[]'sTiago Gigli
I've just applied CU7 to a set of SQL2005 SP2 servers with no problems, except on one server. I've now fixed the problem, but couldn't find description of it elsewhere so post it here in case it helps anyone else with the same problem.
Here's the problem I had. The server is Windows 2003 with two instances of SQL 2005 SP2 (9.00.3186) 1) Ran the patch (SQLServer2005-KB949095-x86-ENU.exe) 2) C: drive ran out of space whilst patch was running against instance A 3) Cleared down space on C: drive 4) Patch had hung, after 45 minutes of no activity I killed it 5) Re-ran patch, it reported instance A as upgraded already and just upgraded instance B 6) After reboot instance A failed to start. Instance B started with no problem.
The service was failing to start with the following recorded in the log: Server Microsoft SQL Server 2005 - 9.00.3239.00 (Intel X86) [] spid5s The resource database build version is 9.00.3186. This is an informational message only. No user action is required. spid5s Error: 5173, Severity: 16, State: 1. spid5s One or more files do not match the primary file of the database. If you are attempting to attach a database, retry the operation with the correct files. If this is an existing database, the file may be corrupted and should be restored from a backup. spid5s Error: 5173, Severity: 16, State: 1. spid5s One or more files do not match the primary file of the database. If you are attempting to attach a database, retry the operation with the correct files. If this is an existing database, the file may be corrupted and should be restored from a backup. spid5s Log file 'C:Program FilesMicrosoft SQL ServerMSSQL.2MSSQLDATAmssqlsystemresource.ldf' does not match the primary file. It may be from a different database or the log may have been rebuilt previously. spid5s The log cannot be rebuilt when the primary file is read-only. spid5s Error: 945, Severity: 14, State: 2. spid5s Database 'mssqlsystemresource' cannot be opened due to inaccessible files or insufficient memory or disk space. See the SQL Server errorlog for details.
I think that the patch must have got part-way through instance A, enough to mark it as being patched, but not far enough to patch the mssqlsystemresource system database (note the version numbers in the log above - 9.00.3239 vs 9.00.3186). The hotfix log records an error opening the registry, but the detailed log was overwritten by the subsequent (successful) run of the hotfix so theres no more detail available.
To fix this I copied in the mssqlsystemresource mdf and ldf files from instance B (which wasnt patched the first time round, and was subsequently patched successfully). From what I understand mssqlsystemresource is read-only and holds copies of system sprocs etc, so a copy will suffice. Plus I am assuming the SQL Server is clever enough to complain if its not happy with the instance of the file.
Note that the problem recorded elsewhere for this error, where mssqlsystemresource or other system DBs have been moved from their original installation folders, was not the cause here. Not sure if this is the 'correct' fix, but it got Instance A up and running. Obviously YMMV