Git Product home page Git Product logo

Comments (7)

TimelordUK avatar TimelordUK commented on June 27, 2024

i no longer have the time to dedicate to this project,

I did update https://github.com/TimelordUK/msnodesqlv8-sequelize to latest version - this is using typescript

i will try and write a similar javascript example

but if i clone rep

npm run install
npm run build
npm run app
> [email protected] app
> node ./dist/demo.js

Executing (d59c9ce7-f4ee-41ba-aa79-c9fcb1d8b2b9): IF OBJECT_ID('[users]', 'U') IS NOT NULL DROP TABLE [users];
Executing (d59c9ce7-f4ee-41ba-aa79-c9fcb1d8b2b9): IF OBJECT_ID('[users]', 'U') IS NULL CREATE TABLE [users] ([id] INTEGER NOT NULL IDENTITY(1,1) , [username] NVARCHAR(255) NULL, [job] NVARCHAR(255) NULL, [createdAt] DATETIMEOFFSET NOT NULL, [updatedAt] DATETIMEOFFSET NOT NULL, PRIMARY KEY ([id]));
Executing (d59c9ce7-f4ee-41ba-aa79-c9fcb1d8b2b9): EXEC sys.sp_helpindex @objname = N'[users]';
Executing (d59c9ce7-f4ee-41ba-aa79-c9fcb1d8b2b9): INSERT INTO [users] ([username],[job],[createdAt],[updatedAt]) OUTPUT INSERTED.[id],INSERTED.[username],INSERTED.[job],INSERTED.[createdAt],INSERTED.[updatedAt] VALUES (@0,@1,@2,@3);
Executing (d59c9ce7-f4ee-41ba-aa79-c9fcb1d8b2b9): INSERT INTO [users] ([username],[job],[createdAt],[updatedAt]) OUTPUT INSERTED.[id],INSERTED.[username],INSERTED.[job],INSERTED.[createdAt],INSERTED.[updatedAt] VALUES (@0,@1,@2,@3);
Executing (d59c9ce7-f4ee-41ba-aa79-c9fcb1d8b2b9): INSERT INTO [users] ([username],[job],[createdAt],[updatedAt]) OUTPUT INSERTED.[id],INSERTED.[username],INSERTED.[job],INSERTED.[createdAt],INSERTED.[updatedAt] VALUES (@0,@1,@2,@3);
Executing (d59c9ce7-f4ee-41ba-aa79-c9fcb1d8b2b9): SELECT [id], [username], [job], [createdAt], [updatedAt] FROM [users] AS [user] WHERE [user].[id] = 3;
{
    "id": 3,
    "username": "techno03",
    "job": "Agile Leader",
    "createdAt": "2024-04-20T10:16:29.973Z",
    "updatedAt": "2024-04-20T10:16:29.973Z"
}
Executing (d59c9ce7-f4ee-41ba-aa79-c9fcb1d8b2b9): SELECT [id], [username], [job], [createdAt], [updatedAt] FROM [users] AS [user] WHERE [user].[job] = N'Agile Leader' ORDER BY [user].[id] OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY;
{
    "id": 3,
    "username": "techno03",
    "job": "Agile Leader",
    "createdAt": "2024-04-20T10:16:29.973Z",
    "updatedAt": "2024-04-20T10:16:29.973Z"
}
const Sequelize = require('sequelize')
const connectionString = 'Driver={ODBC Driver 18 for SQL Server}; Server=DESKTOP-VIUCH90;UID=linux; PWD=linux; Database=node;Encrypt=no;'

const sequelize = new Sequelize({
  dialect: 'mssql',
  dialectModulePath: 'msnodesqlv8/lib/sequelize',
  dialectOptions: {
    user: '',
    password: '',
    database: 'node',
    options: {
      driver: '',
      connectionString,
      trustedConnection: true,
      instanceName: ''
    }
  },
  pool: {
    min: 0,
    max: 5,
    idle: 10000
  }
})

function createUserModel () {
  return sequelize.define('user', {
    username: {
      type: Sequelize.STRING
    },
    job: {
      type: Sequelize.STRING
    }
  })
}

from node-sqlserver-v8.

LightsLegend7276 avatar LightsLegend7276 commented on June 27, 2024

I was able to get it working on my home computer, but within my organization it won't work. I thought maybe there was some dependency conflict so I tried just the example project, but that too failed for the same reason. Within our org we have two drives that mirror each other, so when I am in vscode it shows that there is a conflict in the msnodesqlv8 module because it sees both files.. I'm not sure if that is the issue or if that is just some eslint error, but it's the only module it's happening on even though everything is replicated on both drives. I am going to try clearing my npm cache, deleting project from both drives and recreating in a drive that doesn't replicate to see if it works when I am next at work.

from node-sqlserver-v8.

LightsLegend7276 avatar LightsLegend7276 commented on June 27, 2024

Hi @TimelordUK, hoping you can point me in the right direction here. I think I tracked down the issue. When running the project at home I have a build directory with msnodesqlv8 that util.js requires. Within our org we don't for some reason. Could you let me know how this directory is created. Does it have something to do with gyp? I read through the read me about some pre compiled binaries based on node version and if it doesn't have it we can run node gyp to create our own for the version of node we are using. At home I'm on node v 21.7.3. At work we are on v18.18.0. So when I tried running the node-gyp command our org blocks since it attempting to go out externally to node site to download v18.18.0 tar file. Any help here would be greatly appreciated.

from node-sqlserver-v8.

TimelordUK avatar TimelordUK commented on June 27, 2024

Yes this is related to node gyp. If you go to the releases page you should see all the binaries attached to the release. As part of the install it is absolutely required to either download or compile the sec code into a shared library that is loaded by node. The javascript is a fairly thin wrapper around the cpp which talks to ODBC.

Really it is not recommended to build the code unless necessary and you have someone to hand whom can configure the compiler as it would need build kit from visual studio on windows. On Linux the system compiler would probably work but then you would need ODBC dev headers installed.

Can you download the correct tar manually from Release page in git and unpack it by hand into build/Release folder.

Failing that Iā€™m afraid a sus admin is going to have to at least do that step the library has no chance of working without the compiler code installed alongside javascript.

from node-sqlserver-v8.

LightsLegend7276 avatar LightsLegend7276 commented on June 27, 2024

Hi @TimelordUK, thanks for getting back to me. I was able to get it working locally in my org now by unpacking the tar. But that's on a WIndows VSI. We'd also now have to figure out to get everything done on linux. My only question is why do the pre compiled binaries get built on my home computer without all of these extra steps, but not within our org. Could it be because we are using an older version of this library? We only have up to 3.1.0 available to us and working on node v20.10.

from node-sqlserver-v8.

TimelordUK avatar TimelordUK commented on June 27, 2024

They are not being built on your home pc. The firewall in your org seems to prevent the installation of going to the release page and downloading the correct binary and installing it. This step works at home and. It within organisation. Failing that the library tries to build the src code locally but that as stated requires the compiler and header files. Your only remaining course of action is to manually install binary yourself.

from node-sqlserver-v8.

LightsLegend7276 avatar LightsLegend7276 commented on June 27, 2024

Understood, I was a bit confused here since the pre built script stuff is pretty new to me. Thanks for your time.

from node-sqlserver-v8.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.