Replies: 5 comments 2 replies
-
Does something like this work const connectionString = "Driver={ODBC Driver 17 for SQL Server};Server=(localdb)\\node;Database=scratch;Trusted_Connection=yes;"const sql = require('msnodesqlv8')const query = 'SELECT top 2 * FROM syscolumns'async function runner() { console.log(`using connection '${connectionString}' run query '${query}'`) const res = await sql.promises.query(connectionString, query) console.log(JSON.stringify(res, null, 4))}runner().then(() => { console.log('done.')}).catch(e => { console.error(e)})Sent from my iPadOn 9 Aug 2024, at 19:09, Idexjl ***@***.***> wrote:
I'm probably doing something silly. I am attempting to use a prebuilt release, I found the one I need.
When I go to require it, the only thing I see on the object is a Function Connection. I have a bunch of code that uses it when I build msnodesqlv8, but at work we can't build msnodesqlv8 on our Jenkins box, hence attempting to use the prebuilt
I do something like the below:
const sqlv8 = require("sqlserverv8.node");
when I try to use the query method, I'm told it doesn't have 1 and the only thing I see is a Connection Function.
Thanks!
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
you should not be importing the .node module into your code - this is the
cpp binary which is wrapped with the javascript module - the Connection is
the only exposed class in cpp and you should never call this directly.
Hence it does not look like you are using code provided? where in any of
the examples is this being done?
…On Fri, 9 Aug 2024 at 19:31, Idexjl ***@***.***> wrote:
no, still only have a Connection Function. We downloaded the .tar.gz file
for our platform and I pulled out the .node file, that is what I point my
require at.
when I do a console.log('sql props', sql, sql.promises) after using your
code I get the following
sql props { Connection: [Function Connection] } undefined undefined
its like I have the wrong object from the prebuilt....
—
Reply to this email directly, view it on GitHub
<#341 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABXWJG7LA2CVKYG7CQW2LWLZQUDG5AVCNFSM6AAAAABMI5CGXKVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTAMRZGA2TCNA>
.
You are receiving this because you commented.Message ID:
<TimelordUK/node-sqlserver-v8/repo-discussions/341/comments/10290514@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
if you look at https://github.com/TimelordUK/msnodesqlv8-sequelize this maybe easier above is using with sequelize https://github.com/TimelordUK/msnodesqlv8_yarn_sample i simply do not understand what it is you are trying to do - there is an npm module https://www.npmjs.com/package/msnodesqlv8 this is installed with npm in your project. You are supposed to require this project, never the cpp module normally it will install itself if you are behind a firewall you have to install binary below in build/Release folder ❯ cd msnodesqlv8
❯ cd build
❯ cd Release
❯ ls -alrt
total 588
drwxr-xr-x 4 m m 4096 Jul 6 23:28 .deps
drwxr-xr-x 3 m m 4096 Jul 6 23:29 obj.target
-rwxr-xr-x 2 m m 583984 Jul 6 23:29 sqlserverv8.node
drwxr-xr-x 4 m m 4096 Jul 6 23:29 ..
drwxr-xr-x 4 m m 4096 Jul 6 23:29 .
╭─ ~/dev/src/node_modules/msnodesqlv8/build/Release on master !3
|
Beta Was this translation helpful? Give feedback.
-
Thank you so much, I really appreciate the help. I will look into what you posted below.Sent via the Samsung Galaxy S21 Ultra 5G, an AT&T 5G smartphone
-------- Original message --------From: TimelordUK ***@***.***> Date: 8/11/24 4:23 AM (GMT-07:00) To: TimelordUK/node-sqlserver-v8 ***@***.***> Cc: Idexjl ***@***.***>, Author ***@***.***> Subject: Re: [TimelordUK/node-sqlserver-v8] Prebuilt Release (Discussion #341)
if you look at https://github.com/TimelordUK/msnodesqlv8-sequelize
i simply do not understand what it is you are trying to do - there is an npm module
https://www.npmjs.com/package/msnodesqlv8
this is installed with npm in your project. You are supposed to require this project, never the cpp module
normally it will install itself if you are behind a firewall you have to install binary below in build/Release folder
❯ cd msnodesqlv8
❯ cd build
❯ cd Release
❯ ls -alrt
total 588
drwxr-xr-x 4 m m 4096 Jul 6 23:28 .deps
drwxr-xr-x 3 m m 4096 Jul 6 23:29 obj.target
-rwxr-xr-x 2 m m 583984 Jul 6 23:29 sqlserverv8.node
drwxr-xr-x 4 m m 4096 Jul 6 23:29 ..
drwxr-xr-x 4 m m 4096 Jul 6 23:29 .
╭─ ~/dev/src/node_modules/msnodesqlv8/build/Release on master !3
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Thank you so much!!! I was successful in installing without any C compiler in my tool chain this morning. I realize this wasn't your issue, so truly appreciate you taking the time to help me through this. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm probably doing something silly. I am attempting to use a prebuilt release, I found the one I need.
When I go to require it, the only thing I see on the object is a Function Connection. I have a bunch of code that uses it when I build msnodesqlv8, but at work we can't build msnodesqlv8 on our Jenkins box, hence attempting to use the prebuilt
I do something like the below:
const sqlv8 = require("sqlserverv8.node");
when I try to use the query method, I'm told it doesn't have 1 and the only thing I see is a Connection Function.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions