CONNECT to SQL Puzzler

Before I even start... I did not create this data model and did I not any possibility to change. So, please answer no just wanted to explain how screwed, it is... I know.

Here's the question.

A group can be composed of either blurgs or other groups. So I have three tables:

BLURG
BLURG_ID
BLURG_NAME

GROUP
GROUP_ID
GROUPNAME

MEMBERSHIP_MAP
PARENT_GROUP_ID
MEMBER_GROUP_ID
MEMBER_BLURG_ID

Thus, whenever the MEMBER_GROUP_ID is filled in, the MEMBER_BLURG_ID will be NULL, and whenever the MEMBER_BLURG_ID is filled with the MEMBER_GROUP_ID will be null.

The output that we will show groups that are directly assigned to the Blurg so all the groups who are indirectly affected to the Blurg.

For example, Blurg Joe belongs to the Group of developers PL/SQL. PL/SQL developers group is part of the Group of developers. The developers group belongs to the Nerd group. The Nerd group has no parent.

Blurg Joe belongs to the Group of golfers who has no parent.

So what we want to see is something like that.

BLURG_NAME GroupName Level
JoePL/SQL developers group1
JoeDevelopers2
JoeNerd3
JoeGolfers1

How?

We can't understand what to use for the CONNECT BY clause because the first level are the groups who are directly assigned to the Blurg and subsequently, further up the hierarchy, groups are linked to other groups.

Thank you

-Joe

This seems to work:

B.blurg_name, g.group_name, level SELECT DISTINCT

Blurg b,

GRP g,

membership_map m

WHERE b.blurg_id = 1 - or else

AND g.group_id = m.parent_group_id

START WITH m.member_blurg_id = b.blurg_id

CONNECT BY PRIOR Parent_group_id = member_group_id

Without the DISTINCT, reminds me of the ' Joe / Nerd / 3 "line twice, for reasons not yet understood."

Tags: Database

Similar Questions

  • How to enable a connection to SQL Denali remotely?

    How to enable a connection to SQL Denali remotely?

    Hello

    Your question of Windows is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the public on the TechNet site. Please post your question in the below link:

    http://social.technet.Microsoft.com/forums/en-us/category/SQLServer

  • KB2760411, KB2760588, but now "can NOT CONNECT to" SQL Server!

    Today I faced with the same Windows Update problems as many people - with KB2760411 and KB2760588 constantly reinstall - and try to resolve which included several reboots - system
    ())

    BUT now... a serious problem on one of these machines: cannot access SQL Server!
    Fortunately, I did not run these updates on any * production * machines (I do updates on development machines, first) - this is a development machine - but I still need to get working SQL Server of this machine!

    I tried to use a Windows login to connect and tried to use a SQL Server to connect user, and what it in either, looks like the same message:
    "Cannot connect to ."
    A network-related or instance-specific error all by establishing a connection to SQL Server. The server is not found or inaccessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - could not open a connection to SQL Server) (Microsoft SQL Server, error: 2)

    Note that for windows, this server running Server 2003 (this is why I chose the value of the drop down menu 'windows xp', below).
    and for sql server, run SQL Server 2005.

    Help!?

    ALSO NOTE: I KNOW THIS ISN'T A "NETWORK ERROR."
    because I get the same message when I remote desktop on the server and try it.
    I did try to look in the windows Server 2003 event viewer, but saw nothing relevant under the security, system or Application.

    When I tried it with a sql server login, I clicked on "Show technical details" and got the below (blank lines removed and replaced with the name of the server):

    ===================================
    Unable to connect to .
    ===================================
    A network-related or instance-specific error all by establishing a connection to SQL Server. The server is not found or inaccessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - could not open a connection to SQL Server) (.Net SqlClient data provider)
    ------------------------------
    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=2&LinkId=20476
    ------------------------------
    Error number: 2
    Severity: 20
    State: 0
    ------------------------------
    Location of the program:
    at System.Data.SqlClient.SqlInternalConnection.OnError (SqlException exception, Boolean breakConnection)
    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning (TdsParserStateObject stateObj)
    to System.Data.SqlClient.TdsParser.Connect (ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean ignoreSniOpenTimeout, encrypt Boolean trustServerCert, Boolean, Boolean integratedSecurity, SqlConnection owningObject)
    to System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin (ServerInfo serverInfo, String newPassword, ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject, Boolean)
    at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover (String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
    at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist (SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
    to System.Data.SqlClient.SqlInternalConnectionTds... ctor (DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
    at System.Data.SqlClient.SqlConnectionFactory.CreateConnection (DbConnectionOptions options Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)

    at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection (DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
    at System.Data.ProviderBase.DbConnectionFactory.GetConnection (DbConnection owningConnection)
    at System.Data.ProviderBase.DbConnectionClosed.OpenConnection (DbConnection outerConnection, DbConnectionFactory connectionFactory)
    at System.Data.SqlClient.SqlConnection.Open)
    to Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ObjectExplorer.ValidateConnection (UIConnectionInfo above, IServerType server)
    at Microsoft.SqlServer.Management.UI.ConnectionDlg.Connector.ConnectionThreadUser)

    Thanks Nirmal for the acknowledgement of receipt.

    As you can see, we ended up find us the answer.
    (BOWL is not same document how to grant "Log on as a service", under Server 2008 R2, WHEN ON THE DOMAIN CONTROLLER.)  BOWL documents which fully Server 2003, but only partially for Server 2008 R2.)

    But we are not given the opportunity to "mark as answer" on our own solution.
    If YOU think that the INFORMATION we posted had value, YOU may mark as answer.

    The TechNet link:
    Unable to connect to SQL Server... (includes advice in response: measures to grant permissions in Active Directory, the domain server * RUNNING SERVER 2008 R2 *).

    Thanks again.

  • OLEDB connection to sql server 2005 using ssis 2008 problem

    Hello

    I'm trying to create the oledb connection to sql server 2005 to help using ssis 2008.

    But I get an error message "cannot generate SSPI context".

    More information: -.

    Using SSMS, I can connect to sql server 2005 and the network protocol option, I have to choose is "NamedPipes".

    Are there special properties that I need to put everything in creating some oleb connection via ssis 2008.

    Please help as I am not able to find a solution on technical Web sites.

    I changed the connection oledb connection string.

    Name additional SPN, which is the same as the name of the server and it worked.

  • connection between sql server and java

    someone please tell me how to connect to sql server with java

    Welcome to the forums.

    The forums are a research tool very useful - by using the search box you will see near the top right.  You will find that most of the questions that ask you, which, have already been asked on the forum, so it pays to research frist - that way you get a faster response and you can find other interesting things.

    In this case, I did a quick search using SQL Server and found these threads that will probably help:

    http://supportforums.BlackBerry.com/T5/Java-development/database-connectivity-SQL-Server-2008/m-p/60...

    http://supportforums.BlackBerry.com/T5/Java-development/SQL-Server-connection-in-BB/m-p/416391#M8239...

  • Windows 7 64 bit Pro connects to SQL Server on the Windows Server 2008 R2 Standard domain

    I put upgraded to Windows 7 Professional computers to Windows XP Professional, but I have a problem with getting one of software programs management of stock that allows us to connect to our SQL Server 2008 R2 Standard Windows on new Windows 7 computers.

    Our computers are connected to a domain, and therefore SQL Server. Computers Windows XP allows each user to standard domain to connect and to connect to SQL Server via the stock management software.

    But on the standard domain of Windows 7 Pro computer users unable to connect to SQL Server, but administrator accounts of area on the same Windows 7 Pro computers can connect to SQL Server through the inventory control program.

    I have set up the alias of the server, the server name and port number via the SQL Server Client Network utility ( cliconfg.exe ) so I know this isn't the problem because it works when I'm logged on as a domain administrator.

    There seems to be something to do with permissions of user domain and Windows 7 Pro. There seems to be a change from Windows XP Pro to Windows 7 Pro that does not allow standard domain users to connect to a SQL Server. But I can't find anything about and cannot practice how to solve this problem, except to make all users, domain administrators that is obviously not a good thing to do. So basically I think I need to create a group policy that allows users to connect to SQL Server, but I have no experience in doing this and don't know where to start.

    Thank you for all that you guys help and I hope someone can give me the solution to this problem.

    This issue is beyond the scope of this site and must be placed on Technet or MSDN

    http://social.technet.Microsoft.com/forums/en-us/home

    http://social.msdn.Microsoft.com/forums/en-us/home

  • Developer SQL 4.1.2 uses Windows authentication to connect to SQL Server

    I'm using SQL Developer 4.1.2 and tries to connect to SQL Server through Windows authentication.  If I use SQL Server authentication, everything works so the jTDS driver appears to be installed and working properly (I use jTDS 1.2).  When I switch to Windows authentication, I get the error

    Status: Failure-Test failed: IO error: failure of the SSO: library Native SSPI has not loaded. Check the system java.library.path property.

    Of course, I googled the error and came up with dozens of people asking the same question and is told to move the ntlmauth.dll from the \SSO directory to the jTDS directory in various other directories.  That seems to work for others so for the last few hours, I was copying the DLL in each directory that I can find someone on the internet suggesting without success (I do restart SQL Developer each time).  In the Directory SQL Developer, I tried

    Developer c:\Oracle SQL 4.1.2.20.64\sqldeveloper

    Developer c:\Oracle SQL 4.1.2.20.64\sqldeveloper\sqldeveloper\bin

    Developer c:\Oracle SQL 4.1.2.20.64\sqldeveloper\jdk\jre\bin


    On the off chance that something was still making reference to a directory of a SQL Developer previous install, I put it in the same directories in the front THAT SQL Developer installed on this machine.  On the theory that she was using the FMV of the machine rather than that I downloaded and installed with SQL Developer, I advanced and dropped the DLL in the directory \bin for each installation of Java, that I could find on the system.


    c:\Program Files\Java\jrd1.8.0_45\bin

    C:\Program Files (x86)\Java\jre1.8.0_45\bin

    C:\Program Files (x86)\Java\jre1.8.0_60\bin


    Still no luck.  SQL Developer, I went to help. Everything | Properties and checked that the first way to java.library.path is what I expected and where I dropped the ntlmauth.dll first.  I even put it in c:\windows and c:\windows\system32 just to be sure.


    Java.Library.PathC:\Oracle SQL Developer 4.1.2.20.64\sqldeveloper\sqldeveloper\bin. C:\WINDOWS\Sun\Java\bin; C:\Windows\System32; C:\WINDOWS;


    Despite the DLL just about everywhere that I guess I would need to have it, I still get the same error.  I must be missing something obvious.  But at this point I was looking at it so long that I just can't see it.


    Justin



    I use SQL Developer 4.1.2 and tries to connect to SQL Server through Windows authentication using jTDS 1.2

    Not sure if this has anything to do with your problem, but according to jTDS - SQL Server and Sybase JDBC driver / newsand since SQL Developer 4.1.x requires Java 8, '' you should stick only to jTDS 1.2 If you need to use a version of Java before Java 7 '' . Perhaps using a version 1.3.x jTDS driver might help.

  • How to connect the sql with cloud developer

    Hello

    We are able to create and connect data bases in the clouds, but not sure how to connect with oracle sql developer locally.

    Any help.

    I get the database settings and manage to connect with sql developer

  • How sqlcl can connect to sql server

    Sqlcl can be used to connect to sql server?

    If so, are there references?

    No, Oracle database only.

  • Connection to SQL server 2012 (with Alwayson) of BI Publisher

    How to connect to SQL Server BI publisher 2012 using a headset and connect to a readonly database. I need to know if we can use the 'ApplicationIntent ReadOnly ="parameter. Also, can I install Microsoft SQL Server jdbc 4 on WLS? Please let me know

    I am able to do this work by installing the MS sqljdbc4 on weblogic and specifying the readonly parameter.

  • bad connect to Sql * more via command and cannot log on to the designer (need for connection string)

    I installed Oracle Developer with success, but having bad connect to Sql more than command line, also unable to connect via the developer tools, I get a TNS: Connect timeout occurred. This happens also for the "Plus" Sql for Windows.

    Oracle Forms connect error.png


    However, I can connect via the Sql Plus command window when it is executed from "Start-> all programs", but not when I first run the command window:

    sqlplus error.PNG


    I have a good Oracle 11 g install on Windows 7 and a good developer Sql install so I can connect to databases, but something does not work when you try to connect through these tools. Although Sql Plus works when called from 'Start-> all programs'

    sqlplus scott/tiger - don't use SQL * Net, you can connect like this even with the listener is stopped.

    Developer SQL can ONLY connect using SQL * Net & can be blocked by the firewall

    to connect using sqlplus & SQL * Net, you need to invoke it as below

    sqlplus scott/tiger@orcl

  • Failed to connect to the user when it connects to SQL Server 2008 R2 gateway

    Hi - This is my first post!

    I have problems to connect to a SQL Server 2008 R2 to Oracle database 11 g R2 database, use the product of the gateway.

    Previously, he has worked, but we moved the database SQL 2005 to 2008 (R2).

    We receive this error while trying to query through the link (Select * FROM DUAL@ADSRD)

    ORA-01017: name of user and password invalid. connection refused

    [Oracle] [ODBC SQL Server driver] [SQL Server] Failed to connect to the user 'SQLUSER '. {NativeErr 28000, = 18456} [Oracle] [ODBC SQL Server driver] Invalid connection string attribute {01 S 00}

    ORA-02063: preceding 2 lines of ADSRD

    01017 00000 - "invalid username/password; connection refused '.

    * Cause:

    * Action:

    Error on line: 1 column: 35

    The DG4MSQL configuration is here:

    HS_FDS_CONNECT_INFO = //SSU_PRD_APP/IntegrationStagingDb [BSYS-sql2]

    HS_FDS_TRACE_LEVEL = OFF

    HD_TRANSACTION_MODEL = READ_ONLY

    #HS_FDS_DELAYED_OPEN = FALSE

    HS_FDS_FETCH_ROWS = 100

    HS_OPEN_CURSORS = 50


    The database is hosted in its own instance on the sql2-BSYS Server

    Then... on the SQL Server event logs returns this:

    Failed to connect to the user 'SQLUSER '. Reason: Failed to try to connect using SQL authentication. Server is configured for Windows authentication only. [CLIENT: 192.168.10.179]

    However, the SQL Instance IS configured to enable mixed mode authentication.

    I can't work on what I missed, and I can confirm if I'm actually to a compatibility issue between the gateway and the version of SQL server, that we are now trying to connect.

    Help please!

    Is the user name in your SQL Server database in the capital, mixed mode letters or small letters?

    Currently, you have created a database link that tries to authenticate on the server SQL using SQLUSER in capital letters. If you use mixed or small letters, so be sure to write the user name (and password) as it is in the create database link statement and surround it with double quotes.

    If you have created the link of database correctly, try an ODBC connection for example from your client and add the user name and password. Does it work?

    -Klaus

  • BI Publisher cannot connect to SQL Server.

    Hello

    We try to create a BI Publisher connection to the SQL Server database. However, we receive a message "could not establish a connection. We tried google to find a solution.

    We don't know what the problem is. We can ping the SQL Server computer from the server of BI applications.

    Apparently, it seems that the required JDBC driver files are missing. We use OBIEE version 11.1.1.3.0 and 11.1.1.6.0. How do we know if we have the right JDBC driver file? And also, where we must copy the JDBC driver/jar files to.

    Any help will be much appreciated.

    Thank you and best regards,

    Maury.

    Yes 'Database driver class' is 'hyperion.jdbc.sqlserver.SQLServerDriver' is correct

    and your connection string should like this "jdbc:hyperion:sqlserver://mysqlservername:1433; DatabaseName = master.

    username = his

    password = sa_password

    If does not work, you can try 'other' in the type of driver, and the classpath of weblogic set to connect to SQL Server

    doy, you know what should you do?

  • SQL * PLUS connects with SQL > question

    People,

    I'm confused on the command. / sqlplus with Oracle database.

    According to my understanding,. / sqlplus connected with SQL > using option 3: sysdba, sysoper, sysasm.

    I connect with SQL > to run the rel853.sql script to create a table PSOPRDEFN but a field "OPERPSWDSALT" did not appear in the table PSOPRDEFN although it is in the Create Table statement.

    I connect with SQL * in the directory/home/user/OracleDB_Home/bin as below:


    $ export SYSTEM_PASS = AccessId/mypass

    $ export ORACLE_HOME = / home/user/OracleDB_Home

    $ export ORACLE_SID = HRCS90

    $. / lsnrctl start LISTENER

    $. / AccessId/mypass sqlplus as sysdba

    SQL > startup

    SQL > @/opt/PT8.53/scripts/rel853.sql

    SQL > select OPERPSWDSALT in the AccessId.PSOPRDEFN;

    It returns: "OPERPSWDSALT": invalid identifier.


    I checked the table PSOPRDEFN that the OPERPSWDSALT field did not appear in the table PSOPRDEFN.

    I tried the sysoper option as below:

    $. / sqlplus AccessId/mypass as sysoper

    SQL > startup

    SQL > @/opt/PT8.53/scripts/rel853.sql

    SQL > select OPERPSWDSALT in the AccessId.PSOPRDEFN;

    It returns: "OPERPSWDSALT": invalid identifier.

    The sysoper error is the same thing with sysdba error.

    I tried the sysasm option as below:

    $. / sqlplus AccessId/mypass as sysasm

    He returned: connection refused.


    Someone told me this connection as SYS causes this error. If not a sysdba, sysoper, or sysasm, use the command. / sqlplus AccessId/mypass cannot connect with SQL >.


    My question is:


    First of all, why is what OPERPSWDSALT did not appear in the PSOPRDEFN table while it is in the CREATE TABLE statement?


    Seocond, if not use SYS which is one of the 3 options, how to run the command. / sqlplus AccessId/mypass to connect with SQL > so that CREATE TABLE PSOPRDEFN correctly?

    Thank you.

    user8860348 wrote:

    People,

    Hello. Thanks much for the reply. I just do the commands below:

    $ export SYSTEM_PASS = AccessId/mypass

    $ export ORACLE_HOME = / home/user/OracleDB_Home

    $ export ORACLE_SID = HRCS90

    $. / lsnrctl start LISTENER

    $. / AccessId/mypass sqlplus as sysdba

    SQL > show user;

    Its release: the USER is "SYS".

    SQL > connect AccessId/mypass

    Its output:

    Error: ORA - 01034:ORACLE not available

    ORA-27101: shared memory realm does not exist

    64 - Linux_x86 error: no such file or directory.

    As we see above, unable to connect to the Oracle database AccessId.

    My question is:

    What to do on AccessId, so that it can connect to the Oracle database?

    Thank you.

    so much for the use that you refuse to actually use COPY it PASTE & so that we can see the whole session.

    In the past, you did

    > SQL > startup

    Maybe the database is out of order & must be started.

    do exactly as below (line by line)

    ID

    sqlplus

    / as sysdba

    startup

    connect AccessId/mypass

    COPY the results from above then PASTE all back here

  • Unable to connect to SQL Server

    Hello
    I am interested in the connection to SQL Server, but will have questions. Simply, I can't create a new connection after that I'm pointing the JDBC jar file. Nothing happens when I click on the button +!

    SQL Developer Version: 3.1.07.42
    Java: 1.6.0_11
    OS: Vista, also tried it on XP with the same question

    Please help what am I doing wrong.
    Thank you!

    You cannot use jtds 1.3, you MUST use 1.2 according to our docs here
    http://www.Oracle.com/technetwork/database/migration/omwb-getstarted-093461.html#CONF

Maybe you are looking for

  • Composition of music to listen to my music?

    Why is iTunes saying that I need a music subscription and allow data usuage listen to my music as well as having to redownload the songs I already downloaded on my phone?

  • Is there (and where is) an alpha of the meadow of FF4?

    Hey guys, I saw some rumors on a meadow coefficient alpha of Firefox 4, if the latest version of Minefield, I could find is 3.7a5pre. Is there a pre alpha FF4? And where can I get it back? User Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; RV

  • Can I use the A100 on Satellite L300 collection?

    I have a Satellite L300, which freezes at startup and the f8 function does not work to take me in the recovery menu.I don't have a disc of recovery for this machine, but they have one for a Satellite A100-065.Both machines are running vista. Can you

  • Service using SRVANY. EXE has stopped working on Windows Server 2008 R2

    I have a Windows Server 2008 R2 (64-bit) server that runs as a service for several years a virtual machine VMware Player.  I used the SRVANY old Resource Kit tool. EXE to configure the Windows 8.1 virtual machine to load and run in the background.  T

  • Push Pin information fills the map in MapPoint 2013.

    I use MapPoint 2013 and display data from customer numbers in code pine information push.  The problem is that the info of the push pin fills the card.  Is it possible to change the size of the Push Pin Info and even move around map sothey don't too