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

Cannot bulk load because the file "C:\Users" operating system access denied

$
0
0

Good day;

I'am trying to import json file to sql server 2017 but i encountered  this error

>> Cannot bulk load because the file "C:\Users\user\Documents\sample\generated.json" could not be opened. Operating system error code 5(Access is denied.).

I tried many solution on like changes the permission

https://stackoverflow.com/questions/18286765/sql-server-operating-system-error-5-5access-is-denied

https://stackoverflow.com/questions/14555262/cannot-bulk-load-operating-system-error-code-5-access-is-denied

I tried those solution but unfortunately it doesn't work.

here are my code 

DECLARE @JSON VARCHAR(MAX)

SELECT @JSON = BulkColumn
FROM OPENROWSET 
(BULK 'C:\Users\user\Documents\sample\generated.json', SINGLE_CLOB) 
AS j

my reference is 

https://docs.microsoft.com/en-us/sql/relational-databases/json/import-json-documents-into-sql-server?view=sql-server-2017

Please help to solve this problem


SQL to Communicate With Active Directory

$
0
0

Experts please help,

Objective:

  1. Add users to existing OUs in Active Directory using SQL
  2. Modify user records in Active directory (AD) using SQL, including add/change member of security group

Method:

Build SQL stored procedures with input parameters to update AD either using SQL or PowerShell script 

AD items to add/change using SQL

General:

  • First name
  • Last Name
  • Display Name
  • Description
  • Telephone Number
  • E-mail

Address:

  • Street
  • P.O. Box
  • City
  • State/Province
  • Zip/Postal Code
  • Country/region

Account:

  • User login name @

Profile:

  • Home folder
    • Connect K: to \\xxx.xxx.xx.x\Users\[User login name]

Telephones:

  • Home
  • Pager
  • Mobile
  • Notes

Organization:

  • Job Title
  • Department

Member of:

  • Add Domain User = Default
  • Ability to add user to existing security group

Will also need:

  • SQL to pull list of existing OUs
  • SQL to pull list of existing security groups

 

Database on MSQL keeps disconnecting and we are looking for solutions

$
0
0

We are running Sage (a contracting productivity and accounting software) on our server and one of our data sets keeps intermittentaly disconnecting. The main issue is that I have to disconnect the entire database once everyone leaves to restore it, otherwise it will not work.

Sorry if this is a noob question, I am just looking at guidance on things that I can look for in the error logs because I only find out that this file is disconnected when they tell me so.

Migrating data from SQL Server 2008 R2 to SQL Server 2014

$
0
0
We've migrated the data from SQL Server 2008 R2 to SQL Server 2014. The new SQL Server is on a different machine from the website accessing the data. Because of that, I've changed from Windows authentication to SQL authentication and I provide this in a connection string in the web.config. The website can access fine until it does: "SELECT GET_FILESTREAM_TRANSACTION_CONTEXT()". It then displays an "Access Denied" error: 
[Win32Exception (0x80004005): Access is denied]
   System.Data.SqlTypes.SqlFileStream.OpenSqlFileStream(String path, Byte[] transactionContext, FileAccess access, FileOptions options, Int64 allocationSize) +1624

A network-related or instance-specific error occurred while establishing a connection to SQL Server.

$
0
0

Well, there are many post about this issues but mine is a bit different that I have this problem on my hosting which I can't configure their MS SQL Server. The only thing I can access is Plesk control panel. I have uploaded my mdf file in httpdocs/App_Data, while I establishing the connection it say..

Server Error in '/' Application.

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

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.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

how to access data from sql server

$
0
0
hi, please someone tell me how i access data from data sql server.

Microsoft ODBC driver for Linux 32 bit

$
0
0

I've got a legacy 32-bit application which has to connect to MSSQL server from Linux.

Any packages and drivers found over internets are 64-bit. Is it possible to have 32-bit linux odbc driver?

64-bit Microsoft Text Driver

$
0
0
Hello. Does anyone know where I can download a 64-bit version of the "Microsoft Text Driver (*.txt; *.csv)" ODBC driver?

AD attribute not showing the right value through linked server

$
0
0
I have a linked server setup for AD in SQL 2014. I can query most of the AD attribute except some attribute return as Null if there is a value such Enabled (user status). Any idea? Thanks

Web application calls to SQL Server

$
0
0
Hi guys.  I'm a SQL Server DBA, but know nothing about application connectivity to SQL from custom web apps.  (I do know how to test host connectivity using a ODBC DSN with latest SQL Native Client 11.)  We have in-house web apps connecting to a SQL 2008 R2 SQL Server.  In Activity Monitor, on the SQL 2008 R2, I see connections being made from IIS.  Is it safe to assume those connections are asp.net pages? We are migrating the databases to a SQL Server 2014 AlwaysOn cluster.  One thing I know we need to test is the web apps compatibility with TLS 1.2 which is enforced on our SQL 2014.  Beyond that, do i need to have a conversation with the app/dev team about upgrading their apps client connectivity?  I thought maybe they need to upgrade .Net framework or other client connection libraries on their web servers?  I admit I'm clueless here, so sorry if it's a dumb question.  I just want to ask the question here before discussing with the app dev team.  Thanks.

MSSQL Linux ODBC: Support query interruption with SQLCancel()

$
0
0

We have C++ code originally based on Windows ODBC which talk with MSSQL2017. we have feature to use SQLCancel () API to cancel some query run by SQLExecute function if we believe it is running too long.

The code like that Thread A:  SQLExecute()    

                            Thread B: if think Thread A Query is too long, or Admin manually want to stop query. it will call SQLCancel () which will cancel that Query. For Thread A, that SQLExecute() function will return with following error as expected.

ODBC error. SQLSTATE: HY008 Native error: 0
Message: [Microsoft][ODBC SQL Server Driver]Operation canceled

Notice we use Sync connection for any ODBC operation.

When we move our code to Linux platform, we use latest MSSQL Linux ODBC driver 17.3. and for the same case,

Thread A run SQLExectue() 

Thread B call SQLCancel()

I can see SQLCancel() function return successfully, but SQLExectue() from Thread A will not return and keep hanging. So i need manually Ctrl+C to stop the application. From the syslog, I can see

[ 0] 7efcf80ba8e7 near UGS::Error::Exception::doTraceback(bool) const+0x74  (libsyss.so)
[ 1] 7efcf80dd83a near UGS::Error::Signal::Signal(char const*, int, int, char const*, __va_list_tag*)+0x3f  (libsyss.so)
[ 2] 7efcf80dd870 near UGS::Error::Signal::raise(char const*, int, int, char const*, __va_list_tag*)+0x19  (libsyss.so)
[ 3] 7efcf80dd919 near UGS::Error::Signal::raise(char const*, int, int, char const*, ...)+0x7c  (libsyss.so)
[ 4] 7efcf809b2dd near general_fault_handler(int)+0x145                (libsyss.so)
[ 5] 7efcf2bae950                                                     (libc.so.6)
             -- signal --
[ 6] 7efcf37c9fbb near __libc_recv+0x1a                               (libpthread.so.0)
[ 7] 7efceed38402                                                     (libmsodbcsql-17.3.so.1.1)
[ 8] 7efceedbe3fe                                                     (libmsodbcsql-17.3.so.1.1)
[ 9] 7efceed94d93                                                     (libmsodbcsql-17.3.so.1.1)
[10] 7efceed68ec4                                                     (libmsodbcsql-17.3.so.1.1)
[11] 7efceed533af                                                     (libmsodbcsql-17.3.so.1.1)
[12] 7efceed538b4                                                     (libmsodbcsql-17.3.so.1.1)
[13] 7efceed5f13b                                                     (libmsodbcsql-17.3.so.1.1)
[14] 7efceec9f9ef                                                     (libmsodbcsql-17.3.so.1.1)
[15] 7efceeca01b7                                                     (libmsodbcsql-17.3.so.1.1)
[16] 7efceecac1a2                                                     (libmsodbcsql-17.3.so.1.1)
[17] 7efceecac855                                                     (libmsodbcsql-17.3.so.1.1)
[18] 7efcf4010c29 near SQLExecute+0x1e8                               (libodbc.so.2)

Thread A, hanging around SQLExecute () and never return even Thread B already cancel that query. I check the online document, it say to Cancel the Query, you connection need to be Async, but my question is, why Windows ODBC driver supportCancel the Query even it is Sync Connection, but for Linux ODBC driver, it doesn't work. 

The provider reported an unexpected catastrophic failure in linked server

$
0
0

Hi Sir,

I am getting the below error while fetching 100 records from Oracle database from SQL server 2014.

The OLE DB provider "OraOLEDB.Oracle" for linked server "LINKSER" reported an error. The provider reported an unexpected catastrophic failure.

If i will fetch 99 records then it is getting successfully.Can you please help me on this.I enabled Allow inprocess also.

Cheers,


java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver

$
0
0

Hello, A BIG ERROR of my Programming Life i think. ANYYONE CAN HELP PLEASE ?

I am trying to do a Java & Database Connection through Netbeans 7.4. Everything is going fine except a Error since 2 hours :( 

I googled each and tried everything including Classpath etc etc. and other threads on internet.  When i create a new CONNECTION from services TAB and CLICK > TEST CONNECTION. CONNECTION WAS ESTABLISHED. When i build the project that was Okay. But at Run there is an error.:

run:
Loading Driver...
java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
Goodbye!
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at dbjavaconnection.DBJavaConnection.main(DBJavaConnection.java:25)
BUILD SUCCESSFUL (total time: 0 seconds)


I Am using MS SQL SERVER 2012. Driver Version 4.0. Os : WINDOWS 8. and the code is: 

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package dbjavaconnection;

/**
 *
 * @author Abrar
 */
import java.sql.*;
public class DBJavaConnection {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
         Connection conn = null;
   Statement stmt = null;
   try{
         System.out.println("Loading Driver...");
                Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
                
                System.out.println("Connecting to database...");
                
conn = DriverManager.getConnection("jdbc:sqlserver://LENOVO\\MSSQLSERVER;databaseName=studentdata");

      System.out.println("Creating statement...");
      stmt = conn.createStatement();
      String sql;
      sql = "SELECT id, first, last, age FROM Student";
      
       System.out.println("Executing statement...");
      
             try (ResultSet rs = stmt.executeQuery(sql)) {
                 while(rs.next()){
                     //Retrieve by column name
                     int id  = rs.getInt("id");
                     int age = rs.getInt("age");
                     String first = rs.getString("first");
                     String last = rs.getString("last");
                     
                     //Display values
                     System.out.print("ID: " + id);
                     System.out.print(", Age: " + age);
                     System.out.print(", First: " + first);
                     System.out.println(", Last: " + last);
                 }      }
      stmt.close();
      conn.close();



   }
   catch(SQLException se){
      //Handle errors for JDBC
      se.printStackTrace();
   }catch(Exception e){
      //Handle errors for Class.forName
      e.printStackTrace();
   }finally{
      //finally block used to close resources
      try{
         if(stmt!=null)
            stmt.close();
      }catch(SQLException se2){
      }// nothing we can do
      try{
         if(conn!=null)
            conn.close();
      }catch(SQLException se){
         se.printStackTrace();
      }//end finally try
   }//end try
   System.out.println("Goodbye!");
    }
    
}

Driver Path: C:\Program Files\sqljdbc_4.0\enu\sqljdbc4.jar

How to Connect to SQL Server from another PC via Microsoft Access accdb - ODBC

$
0
0

I have PC with the below configuration:

Windows 10 - 64 bit operating system (working by Administrator Login having no password for login - after startup reach desktop direct)
Microsoft Office 2013
Microsoft SQL Server Management studio 18

Made a home networking so that other PC can connect (like made share folder etc)

A.

Successful From the same PC, I made access accdb file and connected table link method after creating odbc, which was successful and I can do the data entry.

B.

Unsucessful in making odbc from another PC.

(ping by ip is working, can view the share folder made on the other pc)

Followed the link method shown to set the SQL server, so that it can be connected:

https://docs.microsoft.com/en-us/sql/relational-databases/lesson-2-connecting-from-another-computer?view=sql-server-2017  

Then from another PC followed the below process :

From Microsoft Access - External Data - ODBC Database - Link To Data source - (Keeping the Tab on File Data Source) New - Select SQL Server - gave a name - description etc - Server :

\\192.168.10.104\MIASQL  (did not work)

I also tried Server name :

192.168.10.104\MIASQL

MIA-HOMELAPTOP\MIASQL    (tried by name full as mentioned Sql server opening dialog with \\ and without \\)

All same result . Failed . Was searching and found a website  where it shows about a driver (but it for Azure), but confused, something is similar to install on my other PC to connect to server.

https://www.fmsinc.com/MicrosoftAccess/cloud/deploying-linked-azure-sql-databases.html

Request is to review my method and advice what is wrong in my process.

I tried to post the same question in Access group, they ask me to SQL Server group.

I will help, if you can guide a website of video where it show the setup of server to connect from other PC and how to connect from Ms access from other PC via odbc.

Microsoft ODBC driver for SQL Server on Windows Server 2019?

$
0
0
I need to install the Microsoft ODBC driver for SQL Server on a Windows Server 2019 machine (to connect to an Azure SQL database), but the installer for 17 (17.3.1.1) won't let me (says its not a supported OS).  Is there any way to get the updated Microsoft ODBC driver for SQL Server installed in this operating system?

sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : TCP Provider: Error code 0x2746

$
0
0

Hi,

i freshly installed Ubuntu Server 18.04 TLS with MS SQL Server 17 on Ubuntu. After all steps i try to execute on the localhost the command: sqlcmd -S localhost -U sa

and get the upper error. I google a little bit and find out that the TLS 1.2 maybe is the issue.

So i try the command: openssl s_client -connect google.com:443 -tlsl_2
and get a handshake and verification OK

what can i try next to solve this issue?

kindly regards, Lars

ADODB Connection to Azure Database changing to 'master' instead of targeted Database

$
0
0

Attempting to connect to new Azure Database using ADODB method from Access. 

Using ODBC native client 11 Access is able to connect to tables via Link Tables

In script, attempting to connect using ADODB script. Using the following connection string I am able to connect to the database, but an error is logged on the cnn object.

     [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Changed database context to 'master'.

The connection string I am using:

    sConnectionString = "Driver={SQL Server Native Client 11.0};" & _
                        "Server=tcp:###.database.windows.net,1433;" & _
                        "Initial Catalog=###;" & _
                        "Persist Security Info=False;" & _
                        "Uid=###@###;" & _
                        "Pwd={###};" & _
                        "Database='###';" & _
                        "Encrypt=yes;Connection Timeout=30;"

### used to redact info

I have also tried to set the "Current Catalog" value directly after the connection is established.

   cnn.Properties.Item(0).Value ="aglia@agliadb"

Error message reads

   "Property Value is Invalid. Make sure the value is typed correctly"

mis operaciones crud funcionan en modo local , pero a la hora de subirlo a un host , la aplicacion se traba

$
0
0

buenos dias, he desarrollado una aplicacion de proposito estadistico, el asunto es que en modo local , funciona muy bien en las operaciones de crud en las tablas , sin embargo a la hora de montar la aplicacion a un host, resulta que deja de funcionar y se queda trabada, no se que podria ser, les dejo los datos de entrada al host

login : Marco Antonio

password : Marco2019

funcion estadistico

direccion del proyecto 

http://morrotron-001-site1.etempurl.com/

gracias de antemano

SSMS access to SQL 2019 CTP

$
0
0
Cannot connect to Preview SQL 2019 on Ubuntu through SSMS ver 18.2. Can anyone shed some light on this or has anyone had the same problem?

Create a linked server to a single external database

$
0
0

Hello.

This is my USE case.

I have a financial reporting system running on SQL Server that is Sarbanes Oxley compliant. Separation of duties is maintained.

One manager (Tom) has full access to the QA/Dev database. Bob only has read only access to QA/Dev.

Another manager (Bob) has full access to the production database. Tom only has read only access to QA/DEV.

The SQL server contains other databases that neither Tom or Bob have access to. To remain SOX compliant, they can't have access to the other databases.

Tom's developers build financial tables in QA that are tested by the business owner prior to moving to production. Once approved, the entire table must be exported from QA and then imported into Production. Today, we are doing this by (Tom) downloading the table into an Excel file in QA and then (Bob) uploading the file into production.

I would like to create a linked server in QA that links only to the single database. I want to add security in QA to only allow Tom access to the linked server. (i.e. Tom can read from the tables in QA and insert into the tables in production.)

Is this possible? How would I do this in T-SQL?


Dave Livelsberger

Viewing all 4164 articles
Browse latest View live


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