mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
support connect oracle via SID
Some checks are pending
Run tests / test-runner (push) Waiting to run
Some checks are pending
Run tests / test-runner (push) Waiting to run
This commit is contained in:
parent
b87e53b704
commit
50583f928a
@ -142,7 +142,30 @@
|
||||
{/if}
|
||||
|
||||
{#if driver?.showConnectionField('serviceName', $values, showConnectionFieldArgs)}
|
||||
<FormTextField label="Service name" name="serviceName" disabled={isConnected} />
|
||||
<div class="row">
|
||||
<div class="col-9 mr-1">
|
||||
<FormTextField
|
||||
label={$values.serviceNameType == 'sid' ? 'SID' : 'Service name'}
|
||||
name="serviceName"
|
||||
disabled={isConnected}
|
||||
templateProps={{ noMargin: true }}
|
||||
/>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<FormSelectField
|
||||
label="Choose type"
|
||||
isNative
|
||||
name="serviceNameType"
|
||||
defaultValue="serviceName"
|
||||
disabled={isConnected}
|
||||
templateProps={{ noMargin: true }}
|
||||
options={[
|
||||
{ value: 'serviceName', label: 'Service name' },
|
||||
{ value: 'sid', label: 'SID' },
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if driver?.showConnectionField('socketPath', $values, showConnectionFieldArgs)}
|
||||
|
@ -60,6 +60,7 @@ const driver = {
|
||||
databaseUrl,
|
||||
useDatabaseUrl,
|
||||
serviceName,
|
||||
serviceNameType,
|
||||
ssl,
|
||||
isReadOnly,
|
||||
authType,
|
||||
@ -74,7 +75,15 @@ const driver = {
|
||||
client = await oracledb.getConnection({
|
||||
user,
|
||||
password,
|
||||
connectString: useDatabaseUrl ? databaseUrl : port ? `${server}:${port}/${serviceName}` : server,
|
||||
connectString: useDatabaseUrl
|
||||
? databaseUrl
|
||||
: serviceName
|
||||
? serviceNameType == 'sid'
|
||||
? `(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=${server})(PORT=${
|
||||
port || 1521
|
||||
}))(CONNECT_DATA=(SID=${serviceName})))`
|
||||
: `${server}:${port || 1521}/${serviceName}`
|
||||
: `${server}:${port || 1521}`,
|
||||
});
|
||||
if (database) {
|
||||
await client.execute(`ALTER SESSION SET CURRENT_SCHEMA = ${database}`);
|
||||
|
Loading…
Reference in New Issue
Block a user