Quantcast
Channel: SQL Server Data Access forum
Viewing all 4164 articles
Browse latest View live

Report Model Project was missed in sql server 2012

$
0
0

Hi

I have used sql server 2008 for msbi.  I don't have knowledge on "Sql server 2012".

I have installed sql server 2012 in my pc two days back. After installing i have tried to create "Report Model Project" but unable to find this template in "Sql server Data Tolls". Please tell me Why i am facing this problem. Because of not proper installation or Sql server  (or) Sql server didn't provide this template in sql server 2012 version.

And also please let me know Which template i have to use for creating "Analysis Project" which has to create cubes.

Thanks in advance!...


Permission issue : Connection SQL Server 2008r2 from MS Access using VBA

$
0
0

Good morning,

I try to connect to SQL Server using VBA. I used

  sConnect = "ODBC;DRIVER=SQL Server;SERVER=XXXXX;DATABASE=" & Antwort
  sConnect = sConnect & ";" & sUsername & ";" & sPassword
  Set td = CurrentDb.CreateTableDef("dbo_" & sTabNames(i), dbAttachSavePWD, "dbo." & sTabNames(i), sConnect)
   CurrentDb.TableDefs.Append td

SQL Server setup is:  Windows Authentification Login, say val232 (Administrator), and another Login with restricted access, say User / Userpw. This User is the one used in the VBA connection string.

By restricted access is meant: the user User/Userpwcan is granted "Select" data but cannot change the database content (=ReadOnly).

What works:

- Connection to SQL Server and access to the database through MS Management Studio using Windows Authentification val232

- Connection to SQL Server and access to the database through MS Management Studio using User/Userpw ("Select" only).

- Connection to SQL Server and the database through MS Access / VBA on a computer logged in as val232 and VBA sUsername=User and sPassword=Userpw.

- Connecting to the database through MS Access manually: External data --> ODBC Database with User/Userpw being logged as val232 or YYYY (= any arbitrary Windows Login) !

What does not work

- Connection to SQL Server and the database through MS Access / VBA on a computer logged in as YYYY and VBA sUsername User and sPassword Userpw.

Error message in Server Log file is :

State 11

Reason: Token-based server access validation failed with an infrastructure error. Check for previous errors. [CLIENT: 192.168.2.161]

In MS Access is the mysterious part. The error says[Microsoft][ODBC SQL SERVER DRIVER][SQL SERVER]Login failed for user ''YYYY'. The points is that the Windows Login YYYY is not used in the connection string of the VBA Code !!!!

So I suspect that MS Windows (MS Access? ODBC?) used the Windows Authentication in the background for whatever purpose to create the connection. I setup (as an experiment) in the SQL SERVER, Security Login YYYY and the new error message in the Server Error Log is

State 38

Login failed for user YYYY. Reason: Failed to open the explicitly specified database. [CLIENT: 192.168.2.161] 

Well fine but  I would like to connect to SQL Server from MS Access / VBA using User/Userpw independently from the Windows Login ...

and I do not want to give all Windows Login "full" permission on the SQL Server as well as for the User/userpw(it should stay readonly !).

Any help would be greatly appreciated to

1) understand the function of the Windows Login in the connection through VBA

2) find a solution to connect independently from the Windows Login using Ms Access / VBA

Thank you very much for any clues or ideas

(MS Windows is XP 32 bits or Win7 32 bits; Access is 2010 32 bits; Server is 2008R2 64bits)

detach database file from local SQL Server Express instance by C#?

$
0
0

I am using the following C# code to establish a SQL connect to a SQL database file:

 

// connection string

// attach a SQL database file to a local SQL server express instance

string _connectionString = @"Server=.\SQLExpress; AttachDbFilename=C:\BalanceDatabase_1.mdf; Trusted_Connection=Yes; User Instance=True";

 

// using System.Data.SqlClient;

SqlConnection _sqlConnection = new SqlConnection(_connectionString);

// open the connection

_sqlConnection.Open();

 

// do something

 

// close the connection

_sqlConnection.Close();

 

So far, the connection works fine.

 

However, next, I want to copy the database file to another folder. So the following codes:

// source database file name

string sourceDatabaseFileName = @"C:\BalanceDatabase_1.mdf";

// target database file name
string targetDatabaseFileName = @"D:\BalanceDatabase_1.mdf";

// copy database file

System.IO.File.Copy(sourceDatabaseFileName, targetDatabaseFileName, true);

 

Then the program came with runtime exception: "IOException was unhandled: The process cannot access the file 'C:\BalanceDatabase_1.mdf' because it is being used by another process."

 

Is it because the database file was sill attached to the local SQL Server express instance? What can I do to bypass this problem? Detach the database file? or dispose the local SQL Server express instance?

 

Many thanks indeed!

JDBC FIPS Compliant Mode connection

$
0
0

I'm working on an application that requires FIPS 140 compliance mode for TLS connections, following the directions from http://docs.oracle.com/javase/7/docs/technotes/guides/security/jsse/FIPS.html, which work for other TLS connections.  It seems as if the JDBC driver is using a different TrustManager than the default SunJSSE implementation. The following code works when the line new com.sun.net.ssl.internal.ssl.Provider(provider); is commented out, but otherwise produces the error listed below.  Is there a way to enable FIPS 140 compliant connections using the SQL Server JDBC driver?

    public static void main(String[] args) throws Exception {
        Provider provider = new com.rsa.jsafe.provider.JsafeJCE();
        Security.addProvider(provider);
        new com.sun.net.ssl.internal.ssl.Provider(provider);

        Connection conn = null;
        Statement stmt = null;
        ResultSet res = null;
        try {          
            String hostname = "server.example.com";
            String connectionURL = "jdbc:sqlserver://"+hostname+":1433;integratedSecurity=true;database=ozone";
            connectionURL += ";encrypt=true;trustServerCertificate=false";        
            connectionURL += ";trustStore=c:/cacerts;trustStorePassword=changeit";
            System.out.println(connectionURL);
            Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");

            conn = DriverManager.getConnection(connectionURL);
            stmt = conn.createStatement();
            res = stmt.executeQuery("select @@Version");
            if (res.next()) {
                System.out.println(res.getString(1));
            }
        } finally {
            if (res!=null) { try { res.close(); } catch (SQLException sqlEx) {}}
            if (stmt!=null) { try { stmt.close(); } catch (SQLException sqlEx) {}}
            if (conn!=null) { try { conn.close(); } catch (SQLException sqlEx) {}}
        }

    }

I receive an error this error:

Jun 6, 2013 4:01:44 PM com.microsoft.sqlserver.jdbc.TDSChannel enableSSL
INFO: java.security path: C:\Program Files\Java\jdk1.6.0_45\jre\lib\security
Security providers: [SUN version 1.6, SunRsaSign version 1.5, SunJSSE version 1.6, SunJCE version 1.6, SunJGSS version 1.0, SunSASL version 1.5, XMLDSig version 1.0, SunPCSC version 1.6, SunMSCAPI version 1.6, JsafeJCE version 6.001]
SSLContext provider info: Sun JSSE provider(PKCS12, SunX509 key/trust factories, SSLv3, TLSv1)
SSLContext provider services:
[SunJSSE: KeyFactory.RSA -> sun.security.rsa.RSAKeyFactory
  aliases: [1.2.840.113549.1.1, OID.1.2.840.113549.1.1]
, SunJSSE: KeyPairGenerator.RSA -> sun.security.rsa.RSAKeyPairGenerator
  aliases: [1.2.840.113549.1.1, OID.1.2.840.113549.1.1]
, SunJSSE: Signature.MD2withRSA -> sun.security.rsa.RSASignature$MD2withRSA
  aliases: [1.2.840.113549.1.1.2, OID.1.2.840.113549.1.1.2]
, SunJSSE: Signature.MD5withRSA -> sun.security.rsa.RSASignature$MD5withRSA
  aliases: [1.2.840.113549.1.1.4, OID.1.2.840.113549.1.1.4]
, SunJSSE: Signature.SHA1withRSA -> sun.security.rsa.RSASignature$SHA1withRSA
  aliases: [1.2.840.113549.1.1.5, OID.1.2.840.113549.1.1.5, 1.3.14.3.2.29, OID.1.3.14.3.2.29]
, SunJSSE: Signature.MD5andSHA1withRSA -> com.sun.net.ssl.internal.ssl.RSASignature
, SunJSSE: KeyManagerFactory.SunX509 -> com.sun.net.ssl.internal.ssl.KeyManagerFactoryImpl$SunX509
, SunJSSE: KeyManagerFactory.NewSunX509 -> com.sun.net.ssl.internal.ssl.KeyManagerFactoryImpl$X509
, SunJSSE: TrustManagerFactory.SunX509 -> com.sun.net.ssl.internal.ssl.TrustManagerFactoryImpl$SimpleFactory
, SunJSSE: TrustManagerFactory.PKIX -> com.sun.net.ssl.internal.ssl.TrustManagerFactoryImpl$PKIXFactory
  aliases: [SunPKIX, X509, X.509]
, SunJSSE: SSLContext.SSL -> com.sun.net.ssl.internal.ssl.SSLContextImpl
, SunJSSE: SSLContext.SSLv3 -> com.sun.net.ssl.internal.ssl.SSLContextImpl
, SunJSSE: SSLContext.TLS -> com.sun.net.ssl.internal.ssl.SSLContextImpl
, SunJSSE: SSLContext.TLSv1 -> com.sun.net.ssl.internal.ssl.SSLContextImpl
, SunJSSE: SSLContext.Default -> com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl
, SunJSSE: KeyStore.PKCS12 -> com.sun.net.ssl.internal.pkcs12.PKCS12KeyStore
]
TrustManagerFactory provider info: Sun JSSE provider(PKCS12, SunX509 key/trust factories, SSLv3, TLSv1)
TrustManagerFactory default algorithm: PKIX
java.ext.dirs: C:\Program Files\Java\jdk1.6.0_45\jre\lib\ext;C:\Windows\Sun\Java\lib\ext
Exception in thread "main" com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "FIPS mode: only SunJSSE TrustManagers may be used". ClientConnectionId:48715f5b-a62e-45fa-aad9-6cc361d88672
 at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1667)
 at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1668)
 at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1323)
 at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991)
 at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827)
 at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012)
 at java.sql.DriverManager.getConnection(DriverManager.java:582)
 at java.sql.DriverManager.getConnection(DriverManager.java:207)
 at sqlservertest.SQLServerTest.main(SQLServerTest.java:29)
Caused by: java.security.KeyManagementException: FIPS mode: only SunJSSE TrustManagers may be used
 at com.sun.net.ssl.internal.ssl.SSLContextImpl.chooseTrustManager(SSLContextImpl.java:95)
 at com.sun.net.ssl.internal.ssl.SSLContextImpl.engineInit(SSLContextImpl.java:60)
 at javax.net.ssl.SSLContext.init(SSLContext.java:248)
 at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1596)
 ... 7 more
Java Result: 1

Limitations when referencing objects in a linked server?

$
0
0

I'm writing a SQL statement that references a view stored in a database located on a linked SQL Server.

In my SQL, I'm trying to transform some of the retrieved columns using simple CASE statements; for instance, converting numerical codes into their equivalent textual descriptions. Some of the columns have a wide range of values. One of the columns can have a value between 0 and 15. For that column, my statement has 16 CASE expressions that convert each code into its textual equivalent. When I execute the SQL, I get an error that includes the following text:

Statement(s) could not be prepared
Case expressions may only be nested to level 10

When I connect to the linked server and then execute the same statement against the view, it works OK. It's only when I execute the statement referencing the view on the linked server that the error occurs. As the error message states, if I reduce the number of CASE expressions from 15 down to 10, it works OK. 11 or more expressions causes the error.

From this, I surmise that there are limitations when referencing objects in a linked server. Can someone explain those limitations and/or why this error is occurring only when I reference an object on the linked server?

Chris

How to Read data in sql server 2008 from 3 tables

$
0
0

hi guys

I have problem to fetch data from tables

Actually there are tables:

Contact_ Details:  RankId(pk)       CurrentCity

                            1                         a

                            2                         b

                            3                         c

                            4                         d

Primary_ Details:    RankId (fk)         Name       LastName

                                1                          aa            bb

                                2                          cc             dd

                                3                          ee           ff

                                4                          gg            hh

And The Last Table Is:

 Request_ Details  UserId     FriendId 

                               1             3

                               2             3

                               4             1

                               3             4

AFTER That I Have Paramater RankId:  Which Is in clolumn as FriendId In Request_ Details Table

But I want to select UserId FROM Request_Details WHERE FriendId=InputParameter(i Have input parameter)

I want to display information on userId in request table where FriendId=InputParameter


How to insert new,updated records only in the remote server from local server

$
0
0

Hi

I am having locla server and remote server.

In the local server ,i have database table which is inserted,updated regularly.There is no primary key in the table

 .Once in a week i want to copy the differential data to be updated in table of remote server.

Both  table structures are same.

Please help me to find the solution.

Thanks 

Chandran.


Connection to remote SQL Server

$
0
0

All,

Below is my present setup

I have an application server and SQL Server setup at the Head office. Users in the Head Office can connect to the SQL server through the application shortcut menu on their PCs. 

At the Branch site, Users connect to Head Office via VPN connection. They can access network resources in the Head Office but couldn't connect to the SQL Server.

Users get an Error prompt

How do I achieve remote connection from Branch Office to the Head office


o.k


sql server 2000 - array disk gone and can't find the path

$
0
0

I inherited an old sql server that had 2 disks on an array where the datafiles were located.

For some reason the disks were disconnected and all the databases can't come up - they have the (suspect) on their names. I don't have any idea where they were located - we have a bunch of arrays.

udopen: Operating system error 3(The system cannot find the path specified.) during the creation/opening of physical device G:\DATA\CB0102_Data.MDF.
2013-06-07 08:38:29.06 spid11    FCB::Open failed: Could not open device G:\DATA\CB0102_Data.MDF for virtual device number (VDN) 1.
2013-06-07 08:38:29.06 spid9     Starting up database 'CB0103'.

How do I find where the G drive was - machine or IP? If there is a way.

I looked at all the views and tables on master and msdb, all i can see are the local drives.

Thanks

Perl, calling Stored Procedure with valued parameters

$
0
0

How to pass table value parameters to a stored procedure?

I tried following ways

failed

Declare @var Identifiers; Insert into Identifiers values (1), (2);exec usp_getValues NULL, NULL, @var

failed

exec usp_getValues NULL, NULL, {1,2}

A connection was successfully established with the server, but then an error occurred during the pre-login handshake.

$
0
0

I get the following error when trying to view my page.

Can someone please help me with this error. What does it mean and what is the solution to it? Here is the complete error message. -

A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 0 - The specified network name is no longer available.)

OracleTypes.CURSOR equivalent in SQLServer

$
0
0
OracleTypes.CURSOR equivalent in SQLServer

how do i get my cursor working again

$
0
0
When I point the cursor to any item on and try to click, the hour glass doesn't appear and i can't get to what I want.

How to Transfer Data From One Table to Another table on Another Server Using Stored Procedures

$
0
0

hi

i have two database(MYDB1 , MYDB2) on two different server's(SERVER1 , SERVER2) . i want to create an store procedure in MYDB1 on SERVER1 and get some data from a table of MYDB2 on SERVER2.How can i do this?

SQL Error

$
0
0

What's the error related to:

Stored function 'xp_sqlmaint' in the library 'xpstar.dll' generated an access violation,we're getting it in sql 2000 RTM stnd edn.

How to fix it without applying any service pack?


How to creata a view by a executable query.

$
0
0

Hi All,

I am not able to create a view by a executable query which fetch data from multiple table, when i try to create exception occurs "Views containing Unions cannot be represented graphically in the Grid and Diagram panes.

suggestion please 

SQL space Query

$
0
0
Neeq query to find data and log file size ,max file size, disk space- free and total for SQl server 2000 and 2005 within one Table and for all databases.

Network related or instance specific error

$
0
0

Hi,

I can use ip address and port no in connection string to connect to a named-instance.

I can connect with the following connection string:

"Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;
User ID=myUsername;Password=myPassword;"

I cant connect to the instance by specifying instance name.

How do I do it?

Also I cant browse for the instance in SSMS.

Thanks

database mail

$
0
0
how to send db mail when database or table is dropped 

server is not configured for data access error

$
0
0
Hi all, Im relativly new to SQL Server so this may  be a bit of a dumb question.

I have a user who originally was getting the error "could not find server in sys.servers...." when they were trying to delete a record.

So I ran select * from sys.servers and sure enough it was not listed

then

sp_addserver 'SERVER'

they are no longer receiving the could not find server error however they are receiving the server is not configured for data access error. 

What is confusing to me is that this user can log into the database and query for data, just not delete any data.

I am completely stumped as to what is causing this. Not to mention The servers name isn't even 'server' its 'iO' and the ODBC connection is configured properly.

any help would be greatly appreciated

Thanks!

EDIT: the client is running SQL Server 2005
Viewing all 4164 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>