mtxr / vscode-sqltools

Database management for VSCode
https://vscode-sqltools.mteixeira.dev?utm_source=github&utm_medium=homepage-link
MIT License
1.5k stars 302 forks source link

newly created Oracle connection fails, visual studio code #137

Closed diggerydoo68 closed 5 years ago

diggerydoo68 commented 5 years ago

Describe the bug When trying to connect to oracle database with new connection, notification continues to say "You need "oracledb@3.1.1" to connect to database." When I click install i get no response with no connection or a "Request DependencyInstaller/install failed unexpectadly without providing any details" Error with no connection. FYI I have already installed node js and node-oracledb was already installed. I also set the node runtime variable in vscode settings.json. Is there another step I am missing?

To Reproduce Steps to reproduce the behavior:

  1. Create a new connection with Oracle
  2. Enter necessary db details to connection page
  3. click create
  4. See Notification then bug

Expected behavior Connect to database to begin writing queries

Desktop (please complete the following information):

Additional context first time user of sqltools

mickeypearce commented 5 years ago

Hey @diggerydoo68 . Please post output from "Output" view (Ctrl + Shift +U) - channel "SQLTools Language Server" (right corner dropdown) just after the error happens, And also from channell "SQLTools". That would be really helpful. Thanks

mtxr commented 5 years ago

@mickeypearce I'm assigning this one to you, so you can verify and work on it.

If confirmed, let me in case we need to publish it.

Thanks!

diggerydoo68 commented 5 years ago

I realized after looking at the output(thanks for that info) why it was having trouble installing the oracledb extension. Now the extension is installed but I am getting a "ORA-12154: TNS: could not resolve the connect identifier specified" error. Does SQLtools use a ODBC driver? How does sqltools locate the tsnames.ora file?

mickeypearce commented 5 years ago

SQLTools uses node-oracledb driver that uses Oracle native client (Instant Client, for ex.) for connecting to Oracle DB.

Service name should be specified in "database" property of connections setting:

For example if you have tnsnames.ora file with service name defined or any other alternative connection strings:

{ "dialect": "OracleDB", "name": "oracledb2", "username": "hr", "password": "welcome", "askForPassword": false, "connectionTimeout": 15, "database": "oraclpdb" }

from: OracleDB Connections.

If that wouldn't work you can include the whole connection string directly in "database" property: "database: "hostname:port/service_name", including alternative types, etc

Property "port" and "server should be excluded! in this case.


Additional info: Oracle doc for connection strings

mtxr commented 5 years ago

@diggerydoo68 did you get it running?

Let us know so we could close this issue.

diggerydoo68 commented 5 years ago

Still working on it. Where is it writing the connections details to? I don't see it in the settings.json file nor my oracle files (tnsnames.ora or oracle instant client folder). I created a connection through the regular "Setup a new connection" interface and I added the whole connection string to the the "database field" and excluded the port field and it still gave me the above Oracle error after trying to connect.

diggerydoo68 commented 5 years ago

a follow up question does sqltools work with LDAP?

mickeypearce commented 5 years ago

In the workspace settings. Try manually adding connection to settings.json. maybe there is a problem if ./.vscode/settings.json doesn't exist already.

Maybe we should print actual connection string to output for easier debugging or even leave out port and server option completely.

mickeypearce commented 5 years ago

@diggerydoo68 , any luck ?

rogenaro commented 5 years ago

I'm having the same problem as first described. In my case, the installation fails because of the proxy authentication settings. It seems that the installation command does not use the .npmrc settings on my user profile nor the "http.proxy" from vscode?. Do I need to add those settings somewhere else?

mtxr commented 5 years ago

Hmmm. I'll take a look. I haven't tested with a proxy. Should work seamlessly, but I better to take a second look at this.

@rogenaro if you have JS skills and wants to try, take a shot please.

mickeypearce commented 5 years ago

https://github.com/oracle/node-oracledb/issues/856#issuecomment-399797924

There is a link in the comment with proxy instructions.

@mtxr, where libs get installed to try this first manually? In the ext folder or somewhere else?

mtxr commented 5 years ago

In the extension directory.

I'm on the phone right now. But a quick googling should be enough to find the extensiona folder location.

But we have 2 issues here. The oracle connection using proxy and the npm install with proxy. Can you work on the connection issue?

I'll work on the npm issue.

On Thu, Mar 21, 2019, 19:56 mickeypearce notifications@github.com wrote:

oracle/node-oracledb#856 (comment) https://github.com/oracle/node-oracledb/issues/856#issuecomment-399797924

There is a link in the comment with proxy instructions.

@MxTR https://github.com/MxTR, where libs get installed to try this manually? In the ext folder or somewhere else?

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/mtxr/vscode-sqltools/issues/137#issuecomment-475433766, or mute the thread https://github.com/notifications/unsubscribe-auth/AArL6atE5cD0huZI6pk6Qgb2cdqAd5dBks5vZA4ygaJpZM4bt4l1 .

mtxr commented 5 years ago

@rogenaro can you provide some information about your setup? Which OS, npm/node version are you using? Where is you npmrc file? Workspace dir or home dir?

Thanks!

diggerydoo68 commented 5 years ago

no dice. I manually added the connection details to the settings.json file. I ran it and it still gave me the TNS error. How do I know that it is using that settings file? If I go and create the connection through the extension interface it does not change my settings.json file. Should it? I also tried leaving out the server and port option. It still gives me the TNS oracle error. I'm a little fuzzy on how I can print the connection string to the output interface. How would that work with this extension?

mickeypearce commented 5 years ago

@mtxr , do you perhaps have any idea why it wouldn't add/create settings file? I tried with no folder open, but it prints an error about not opened workspace. 👍

@diggerydoo68 , yes, it should be added to your workspace setting file. Do you see your connection in connection explorer? Can you please check your user settings if it was added there for some reason. (%USERPROFILE%\AppData\Roaming\Code\User\settings.json or "Preferences: Open User Settings" command.

diggerydoo68 commented 5 years ago

ok so whenever I create a new connection it shows up in the connection explorer and the connection details are written to the settings.json from the workspace directory and nothing gets written to the settings.json for the user settings (%USERPROFILE%\AppData\Roaming\Code\User\settings.json ). I need to keep my settings.json files straight. So usually I am connecting via sqldeveloper to the database using an LDAP connection.

mickeypearce commented 5 years ago

About LDAP connection: https://github.com/oracle/node-oracledb/issues/287#issuecomment-158244196 There is a link in the comment that could be helpful. Unfortunately you need some extra steps.

mtxr commented 5 years ago

@mickeypearce it's a bug. We should be able to create connections for workspaces, or just in user settings.

I'll fix this tonight. Thanks!

mtxr commented 5 years ago

I've fixed the add connection issue. I'm keeping the default behavior but I added an option to always save to globalSettings.

I'll close this issue since @mickeypearce comment seems to resolve the LDAP connection.

@mickeypearce or @diggerydoo68 would be great if you could write a guide to get LDAP running with the extension.

@diggerydoo68 if it doesn't solve your problem, feel free to reopen this issue for further investigation.

Thank you all!

Linh1706 commented 5 years ago

I tried to use this plugin to connect to my work database but no luck. Still using Datagrip with no problem.

DEBUG: Settings updated! INFO: Telemetry enabled! DEBUG: Event: sessionStarted:extension DEBUG: Connection explorer updated. DEBUG: Activation time: 471.88162ms INFO: Executing SQLTools.selectConnection ERROR: Error: { [Error: Request DependencyInstaller/install failed unexpectedly without providing any details. at C:\Users\linhnb.vscode\extensions\mtxr.sqltools-0.20.2\extension.js:1:22983 at C:\Users\linhnb.vscode\extensions\mtxr.sqltools-0.20.2\extension.js:1:23390 at Immediate.module.exports.messageQueue.size.setImmediate (C:\Users\linhnb.vscode\extensions\mtxr.sqltools-0.20.2\extension.js:1:23934) at runCallback (timers.js:694:18) at tryOnImmediate (timers.js:665:5) at processImmediate (timers.js:647:5)] code: -32603, data: undefined } INFO: Executing SQLTools.selectConnection ERROR: Error: { [Error: Request DependencyInstaller/install failed unexpectedly without providing any details. at C:\Users\linhnb.vscode\extensions\mtxr.sqltools-0.20.2\extension.js:1:22983 at C:\Users\linhnb.vscode\extensions\mtxr.sqltools-0.20.2\extension.js:1:23390 at Immediate.module.exports.messageQueue.size.setImmediate (C:\Users\linhnb.vscode\extensions\mtxr.sqltools-0.20.2\extension.js:1:23934) at runCallback (timers.js:694:18) at tryOnImmediate (timers.js:665:5) at processImmediate (timers.js:647:5)] code: -32603, data: undefined } INFO: Executing SQLTools.showOutputChannel