A question on JDBC Drivers.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dmjpro
    Top Contributor
    • Jan 2007
    • 2476

    #1

    A question on JDBC Drivers.

    I think most of the Java programmers use Netbeans.
    I am using NetBeans 5.5 here what I saw here that if a JDBC Driver is added to connect a database then it automatically finds out the Driver Class and gets the URL pattern.
    Could you help me to do that?

    Debasis Jana.
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by dmjpro
    I think most of the Java programmers use Netbeans.
    I am using NetBeans 5.5 here what I saw here that if a JDBC Driver is added to connect a database then it automatically finds out the Driver Class and gets the URL pattern.
    Could you help me to do that?

    Debasis Jana.
    Help you do what exactly?

    Comment

    • JosAH
      Recognized Expert MVP
      • Mar 2007
      • 11453

      #3
      Originally posted by r035198x
      Help you do what exactly?
      If Netbeans can do that (which I doubt) I'm prettiy sure that feature is described
      somewhere in its manuals and/or documentation. All it takes is a bit of reading
      which still is legal according to any (constitutional ) law ;-)

      kind regards,

      Jos

      Comment

      • dmjpro
        Top Contributor
        • Jan 2007
        • 2476

        #4
        Originally posted by JosAH
        If Netbeans can do that (which I doubt) I'm prettiy sure that feature is described
        somewhere in its manuals and/or documentation. All it takes is a bit of reading
        which still is legal according to any (constitutional ) law ;-)

        kind regards,

        Jos
        Actually NetBeans have that manual what it does internally?

        Debasis Jana

        Comment

        • JosAH
          Recognized Expert MVP
          • Mar 2007
          • 11453

          #5
          Originally posted by dmjpro
          Actually NetBeans have that manual what it does internally?

          Debasis Jana
          I don't know; I don't use Netbeans and I check the name of the JDBC driver and
          its URL manually; I always like to know what I and my code are doing.

          kind regards,

          Jos

          Comment

          • dmjpro
            Top Contributor
            • Jan 2007
            • 2476

            #6
            Originally posted by JosAH
            If Netbeans can do that (which I doubt)
            Josh I am using NetBeans 5.5. There is a Tag runtime where you can get an option database then you can create a new connection by right clicking on it, if there is no JDBC jar file then you can add jar by right clicking on drivers.
            Whenever you click on new connection then all the available drivers you can see and you can choose from it ..then two basic things automatically come. One is driver class and another one is URL_Pattern. Then change the URL pattern by host name,port database name and connect to the database.
            Now my Question is .. How is it possible?
            One more thing if i write a driver class then who all approve this.
            What i meant that specification should be there.
            As the driver class must implement Driver interface....so on so on.
            I want to know those specification.

            Debasis Jana.

            Comment

            • dmjpro
              Top Contributor
              • Jan 2007
              • 2476

              #7
              Originally posted by JosAH
              I don't know; I don't use Netbeans and I check the name of the JDBC driver and
              its URL manually; I always like to know what I and my code are doing.
              kind regards,

              Jos
              This is my Question how do you check that ....?
              By programatically or from some where else?


              Debasis Jana

              Comment

              • JosAH
                Recognized Expert MVP
                • Mar 2007
                • 11453

                #8
                Originally posted by dmjpro
                This is my Question how do you check that ....?
                By programatically or from some where else?
                By reading the accompanying documentation?

                kind regards,

                Jos

                Comment

                • dmjpro
                  Top Contributor
                  • Jan 2007
                  • 2476

                  #9
                  Originally posted by JosAH
                  By reading the accompanying documentation?
                  kind regards,

                  Jos
                  So you don't do that programatically .
                  Ok fine!
                  Thanks for ur kind help.

                  Comment

                  • JosAH
                    Recognized Expert MVP
                    • Mar 2007
                    • 11453

                    #10
                    Originally posted by dmjpro
                    So you don't do that programatically .
                    Ok fine!
                    Thanks for ur kind help.
                    I wonder how that should be done programmaticall y; check every single class
                    whether or not it implements the java.sql.Driver interface? Nah, I think not and
                    then again one can't figure out the URL given a certain Driver implementation
                    because a Driver only tells you whether or not it accepts a certain URL.

                    Come to think of it again: your original question doesn't make sense, i.e. it
                    can't be done without any human help, from a human who read the documentation
                    that is.

                    kind regards,

                    Jos

                    Comment

                    • JosAH
                      Recognized Expert MVP
                      • Mar 2007
                      • 11453

                      #11
                      Originally posted by dmjpro
                      Josh I am using NetBeans 5.5. There is a Tag runtime where you can get an option database then you can create a new connection by right clicking on it, if there is no JDBC jar file then you can add jar by right clicking on drivers.
                      Whenever you click on new connection then all the available drivers you can see and you can choose from it ..then two basic things automatically come. One is driver class and another one is URL_Pattern. Then change the URL pattern by host name,port database name and connect to the database.
                      Now my Question is .. How is it possible?
                      One more thing if i write a driver class then who all approve this.
                      What i meant that specification should be there.
                      As the driver class must implement Driver interface....so on so on.
                      I want to know those specification.

                      Debasis Jana.
                      In your OP you were wondering how Netbeans did that automatically and now you're
                      telling us that a user has to supply the necessary information. *sigh*

                      kind regards,

                      Jos

                      ps. the driver specification is all in the JDBC API documentation. You 'just' have
                      to implement it for your database.

                      Comment

                      • dmjpro
                        Top Contributor
                        • Jan 2007
                        • 2476

                        #12
                        Originally posted by JosAH
                        In your OP you were wondering how Netbeans did that automatically and now you're
                        telling us that a user has to supply the necessary information. *sigh*

                        kind regards,

                        Jos

                        ps. the driver specification is all in the JDBC API documentation. You 'just' have
                        to implement it for your database.
                        Josh don't misunderstand me.
                        I am sorry if I did anything wrong.
                        Now .... In netbeans user only provides the jar class then four text fields come.
                        Driver class Name(Readonly user can't change even by mistake).
                        URL Pattern ...comes like this ...
                        if i select PsotgreSQL ...then (jdbc:postgresq l://<HOST>:<PORT>/<DB>)
                        if i select Sybase ....then jdbc:sybase:Tds :<HOST>:<PORT>
                        you have to change the required value.
                        and last two are use name and password.

                        So how Nebeans configure out those two things?

                        Debasis Jana.

                        Comment

                        • BigDaddyLH
                          Recognized Expert Top Contributor
                          • Dec 2007
                          • 1216

                          #13
                          Originally posted by dmjpro
                          I think most of the Java programmers use Netbeans.
                          I would have guessed Eclipse and it's derivatives (IBM Websphere).

                          Comment

                          • Paul NIcolai Sunga
                            New Member
                            • Mar 2008
                            • 43

                            #14
                            Originally posted by dmjpro
                            I think most of the Java programmers use Netbeans.
                            I am using NetBeans 5.5 here what I saw here that if a JDBC Driver is added to connect a database then it automatically finds out the Driver Class and gets the URL pattern.
                            Could you help me to do that?

                            Debasis Jana.

                            what if you try to use the odbc driver?..

                            Comment

                            • BigDaddyLH
                              Recognized Expert Top Contributor
                              • Dec 2007
                              • 1216

                              #15
                              Originally posted by Paul NIcolai Sunga
                              what if you try to use the odbc driver?..
                              Why? I think of the odbc driver as a last resort, and the OP mentioned Oracle, which has much better drivers available for it. Why do you suggest odbc?

                              Comment

                              Working...