Results 1 to 20 of 20
  1. #1
    mexyz is offline Member
    Join Date
    Feb 2010
    Posts
    5
    Rep Power
    0

    Default Call Java Method in MS SQL

    Hi all,

    Is there a way to call a java method in ms sql? I've only tried it in Orale. I want to do the same with MS SQL. Thanks in advance :)

  2. #2
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    765
    Rep Power
    6

    Default

    Please explain some more.Your question is not clear.Did u mean database calls via java?
    Ramya:cool:

  3. #3
    mexyz is offline Member
    Join Date
    Feb 2010
    Posts
    5
    Rep Power
    0

    Default

    I mean, calling a java method that resides in ms sql database. I want to put my java classes in the database and be able to invoke the methods in the database and vice versa.

  4. #4
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    765
    Rep Power
    6

    Default

    I think u are talking about jdbc...Do u want to perform any database operations from java?
    Ramya:cool:

  5. #5
    mexyz is offline Member
    Join Date
    Feb 2010
    Posts
    5
    Rep Power
    0

    Default

    I am able to connect to database from java through jdbc. How about from database to java? Is there such a thing like that in ms sql? Is there a way to put all my java methods as ms sql database package?
    Ohh no.. sorry if I can't get my query clear for you. In Oracle, there is a support in developing, storing and deploying Java applications. I want to know if ms sql has that support also for java. Thank you so much :)

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    18

    Default

    Nope.
    That was easy...

    Oracle has a Java engine inside it, MS SQL does not.

  7. #7
    mexyz is offline Member
    Join Date
    Feb 2010
    Posts
    5
    Rep Power
    0

    Default

    Thanks for the replies.
    So, there is also no way to store Java methods or classes to MS SQL database?
    Last edited by mexyz; 02-16-2010 at 12:29 PM.

  8. #8
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    18

    Default

    Well, I suppose you could store them in there, but what you'd do with them I don't know.

  9. #9
    FON
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    364
    Rep Power
    5

    Default

    There is a Thread on this forum with full example of
    storing java object into Oracle DB:


    How to insert java Object in oracle database

    So it is serialization story, but what everybody here want to know is
    what is purpose of your question
    and what are you trying to do with Java and MS SQL?

    What kind of methods you plan to store there, why and what is purpose
    of calling them in that way.

    If you answer this i'm sure many will try to help including me ;)

  10. #10
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    18

    Default

    Oracle has a built in Java engine, so you can write Java classes/methods and compile them into Oracle itself, allowing you to call them as though they were stored procedures. The OP is asking if you can do the same in MS SQL.

    And now wants to know if you can save classes (not serilialized objects) in MS SQL. For what purpose I don't know, since they won't be able to run them...

  11. #11
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    765
    Rep Power
    6

    Default

    I don't think MS SQL has that built in java engine.I have to explore more to confirm u.

    I think our moderators can confirm.
    Ramya:cool:

  12. #12
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    18

    Default

    No, it doesn't.

  13. #13
    mexyz is offline Member
    Join Date
    Feb 2010
    Posts
    5
    Rep Power
    0

    Default

    Yes, I want to store Java classes in MS SQL Server and execute them within the database.

    @Tolls: "...since they won't be able to run them..." -> MS SQL won't be able to run the classes because it doesn't have Java engine, am I right?

  14. #14
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    18

    Default

    Yes.
    The only db I am aware of that contains a JVM is Oracle.
    That is, a JVM which will run Java stuff as though they were stored procedures.
    Oracle fluffs about with them and sticks a PL/SQL front end on them.

  15. #15
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    SQL Server stored procedures can call COM objects which can call Java. That approach is probably very painful to implement in a portable manner.

    The latest versions of SQL Server have the .NET framework runtime. This means you can write stored procedures in any managed .NET language. That is probably a better route to go.

    DB2 also supports Java stored procedures.

  16. #16
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    18

    Default

    db2 does?
    Surprises me a bit.

  17. #17
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    You can define so called external stored procedures in quite a few languages actually (including some M$ languages).

    Postgres also supports Java, Perl,Python,C++ ...

  18. #18
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    You can define so called external stored procedures in quite a few languages actually (including some M$ languages).

    Postgres also supports Java, Perl,Python,C++ ...

  19. #19
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    18

    Default

    Ah, that's not quite the same beast.
    Oracle stores it all internally, which is what I think this chap is after.
    You're not making any external calls at all.

    Postgres, for example, isn't running the Java as part of the db.

  20. #20
    FON
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    364
    Rep Power
    5

Similar Threads

  1. how to call method?
    By leapinlizard in forum New To Java
    Replies: 9
    Last Post: 04-29-2009, 11:55 PM
  2. Call java method from jsp
    By saiphani723 in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 02-25-2009, 11:21 AM
  3. How to call method in servet by using JSP?
    By frankjava1 in forum Java Servlet
    Replies: 2
    Last Post: 10-24-2008, 04:20 AM
  4. Call Java Method
    By hussainzim in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 05-15-2008, 07:22 AM
  5. cannot call private method from static method
    By jon80 in forum New To Java
    Replies: 3
    Last Post: 05-07-2008, 08:37 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •