Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #9463 > unrolled thread

looking for a simple JAVA code to attach to SQL via ODBC

Started byeAddict <eaddict@gmail.com>
First post2011-11-03 13:04 -0700
Last post2011-11-04 21:45 -0400
Articles 9 — 4 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  looking for a simple JAVA code to attach to SQL via ODBC eAddict <eaddict@gmail.com> - 2011-11-03 13:04 -0700
    Re: looking for a simple JAVA code to attach to SQL via ODBC Lew <lewbloch@gmail.com> - 2011-11-03 13:54 -0700
      Re: looking for a simple JAVA code to attach to SQL via ODBC Arne Vajhøj <arne@vajhoej.dk> - 2011-11-03 17:01 -0400
        Re: looking for a simple JAVA code to attach to SQL via ODBC Lew <lewbloch@gmail.com> - 2011-11-03 18:06 -0700
          Re: looking for a simple JAVA code to attach to SQL via ODBC Arne Vajhøj <arne@vajhoej.dk> - 2011-11-03 22:28 -0400
      Re: looking for a simple JAVA code to attach to SQL via ODBC Roedy Green <see_website@mindprod.com.invalid> - 2011-11-04 15:53 -0700
    Re: looking for a simple JAVA code to attach to SQL via ODBC Arne Vajhøj <arne@vajhoej.dk> - 2011-11-03 16:59 -0400
    Re: looking for a simple JAVA code to attach to SQL via ODBC Roedy Green <see_website@mindprod.com.invalid> - 2011-11-03 22:07 -0700
      Re: looking for a simple JAVA code to attach to SQL via ODBC Arne Vajhøj <arne@vajhoej.dk> - 2011-11-04 21:45 -0400

#9463 — looking for a simple JAVA code to attach to SQL via ODBC

FromeAddict <eaddict@gmail.com>
Date2011-11-03 13:04 -0700
Subjectlooking for a simple JAVA code to attach to SQL via ODBC
Message-ID<88b3745a-8824-4863-b97e-f793b571b966@m19g2000yqh.googlegroups.com>
First, a bit of background.  I am trying to get UDConnect (a SAP
product) to work.  This requires a JAVA connection from the HP-UX
system to a MS SQL server using an ODBC driver.

I looked at the MS knowledge base (http://support.microsoft.com/kb/
313100) to see some sample code.  Well, this sample is good if going
from a MS system to another MS system.

Problem is I don't know/code Java.  I would like to have a simple java
program on my HP-UX system that tests the ODBC connection the same way
the MS example does.

Anyone have a sample they can share?
Thanks!
Vince

[toc] | [next] | [standalone]


#9467

FromLew <lewbloch@gmail.com>
Date2011-11-03 13:54 -0700
Message-ID<31728236.280.1320353657204.JavaMail.geo-discussion-forums@prgt40>
In reply to#9463
On Thursday, November 3, 2011 1:04:41 PM UTC-7, eAddict wrote:
> First, a bit of background.  I am trying to get UDConnect (a SAP
> product) to work.  This requires a JAVA connection from the HP-UX
> system to a MS SQL server using an ODBC driver.

You want to avoid connecting to the DBMS via ODBC.  Use JDBC (Java DataBase Connectivity) or, better yet, JPA (Java Persistence API).  EclipseLink and Apache OpenJPA are two good JPA implementations.

> I looked at the MS knowledge base (http://support.microsoft.com/kb/
> 313100) to see some sample code.  Well, this sample is good if going
> from a MS system to another MS system.

You're talking about Java.  Microsoft will not be your best source of information about Java.

IBM Developerworks and the Oracle Java pages are your best initial source.

> Problem is I don't know/code Java.  I would like to have a simple java
> program on my HP-UX system that tests the ODBC connection the same way
> the MS example does.
> 
> Anyone have a sample they can share?

Mostly Java programs do not use ODBC.  In the rare cases where they do, it's ugly.  It's much better to connect directly to the database through Java than to go through yet another intermediate layer.

-- 
Lew

[toc] | [prev] | [next] | [standalone]


#9470

FromArne Vajhøj <arne@vajhoej.dk>
Date2011-11-03 17:01 -0400
Message-ID<4eb30125$0$289$14726298@news.sunsite.dk>
In reply to#9467
On 11/3/2011 4:54 PM, Lew wrote:
> On Thursday, November 3, 2011 1:04:41 PM UTC-7, eAddict wrote:
>> First, a bit of background.  I am trying to get UDConnect (a SAP
>> product) to work.  This requires a JAVA connection from the HP-UX
>> system to a MS SQL server using an ODBC driver.
>
> You want to avoid connecting to the DBMS via ODBC.  Use JDBC (Java DataBase Connectivity) or, better yet, JPA (Java Persistence API).  EclipseLink and Apache OpenJPA are two good JPA implementations.
>
>> I looked at the MS knowledge base (http://support.microsoft.com/kb/
>> 313100) to see some sample code.  Well, this sample is good if going
>> from a MS system to another MS system.
>
> You're talking about Java.  Microsoft will not be your best source of information about Java.
>
> IBM Developerworks and the Oracle Java pages are your best initial source.
>
>> Problem is I don't know/code Java.  I would like to have a simple java
>> program on my HP-UX system that tests the ODBC connection the same way
>> the MS example does.
>>
>> Anyone have a sample they can share?
>
> Mostly Java programs do not use ODBC.  In the rare cases where they do, it's ugly.  It's much better to connect directly to the database through Java than to go through yet another intermediate layer.

The link is using JDBC and not via the JDBC ODBC bridge.

And direct JDBC is probbaly better than JPA for testing connectivity!

Arne


[toc] | [prev] | [next] | [standalone]


#9488

FromLew <lewbloch@gmail.com>
Date2011-11-03 18:06 -0700
Message-ID<11320388.182.1320368767789.JavaMail.geo-discussion-forums@prev11>
In reply to#9470
On Thursday, November 3, 2011 2:01:24 PM UTC-7, Arne Vajhøj wrote:
> On 11/3/2011 4:54 PM, Lew wrote:
> > On Thursday, November 3, 2011 1:04:41 PM UTC-7, eAddict wrote:
> >> First, a bit of background.  I am trying to get UDConnect (a SAP
> >> product) to work.  This requires a JAVA connection from the HP-UX
> >> system to a MS SQL server using an ODBC driver.
> >
> > You want to avoid connecting to the DBMS via ODBC.  Use JDBC (Java DataBase Connectivity) or, better yet, JPA (Java Persistence API).  EclipseLink and Apache OpenJPA are two good JPA implementations.
> >
> >> I looked at the MS knowledge base (http://support.microsoft.com/kb/
> >> 313100) to see some sample code.  Well, this sample is good if going
> >> from a MS system to another MS system.
> >
> > You're talking about Java.  Microsoft will not be your best source of information about Java.
> >
> > IBM Developerworks and the Oracle Java pages are your best initial source.
> >
> >> Problem is I don't know/code Java.  I would like to have a simple java
> >> program on my HP-UX system that tests the ODBC connection the same way
> >> the MS example does.
> >>
> >> Anyone have a sample they can share?
> >
> > Mostly Java programs do not use ODBC.  In the rare cases where they do, it's ugly.  It's much better to connect directly to the database through Java than to go through yet another intermediate layer.
> 
> The link is using JDBC and not via the JDBC ODBC bridge.

And the OP asked for ODBC.  I was responding to his question, not to the link.

> And direct JDBC is probbaly better than JPA for testing connectivity!

If that's all you're doing, sure.  Couldn't agree more.

-- 
Lew

[toc] | [prev] | [next] | [standalone]


#9499

FromArne Vajhøj <arne@vajhoej.dk>
Date2011-11-03 22:28 -0400
Message-ID<4eb34ddd$0$282$14726298@news.sunsite.dk>
In reply to#9488
On 11/3/2011 9:06 PM, Lew wrote:
> On Thursday, November 3, 2011 2:01:24 PM UTC-7, Arne Vajhøj wrote:
>> On 11/3/2011 4:54 PM, Lew wrote:
>>> On Thursday, November 3, 2011 1:04:41 PM UTC-7, eAddict wrote:
>>>> First, a bit of background.  I am trying to get UDConnect (a SAP
>>>> product) to work.  This requires a JAVA connection from the HP-UX
>>>> system to a MS SQL server using an ODBC driver.
>>>
>>> You want to avoid connecting to the DBMS via ODBC.  Use JDBC (Java DataBase Connectivity) or, better yet, JPA (Java Persistence API).  EclipseLink and Apache OpenJPA are two good JPA implementations.
>>>
>>>> I looked at the MS knowledge base (http://support.microsoft.com/kb/
>>>> 313100) to see some sample code.  Well, this sample is good if going
>>>> from a MS system to another MS system.
>>>
>>> You're talking about Java.  Microsoft will not be your best source of information about Java.
>>>
>>> IBM Developerworks and the Oracle Java pages are your best initial source.
>>>
>>>> Problem is I don't know/code Java.  I would like to have a simple java
>>>> program on my HP-UX system that tests the ODBC connection the same way
>>>> the MS example does.
>>>>
>>>> Anyone have a sample they can share?
>>>
>>> Mostly Java programs do not use ODBC.  In the rare cases where they do, it's ugly.  It's much better to connect directly to the database through Java than to go through yet another intermediate layer.
>>
>> The link is using JDBC and not via the JDBC ODBC bridge.
>
> And the OP asked for ODBC.  I was responding to his question, not to the link.

My guess was that the link was important so that he really meant
JDBC not ODBC.

ODBC is not an obvious choice on HP-UX either. I would be surprised
if the JDBC ODBC bridge even exist in Java on HP-UX.

>> And direct JDBC is probbaly better than JPA for testing connectivity!
>
> If that's all you're doing, sure.  Couldn't agree more.

That seems to be what he want.

Arne

[toc] | [prev] | [next] | [standalone]


#9536

FromRoedy Green <see_website@mindprod.com.invalid>
Date2011-11-04 15:53 -0700
Message-ID<s3r8b71jrduc2eldlpa5pkmvd5b1eq35pc@4ax.com>
In reply to#9467
On Thu, 3 Nov 2011 13:54:16 -0700 (PDT), Lew <lewbloch@gmail.com>
wrote, quoted or indirectly quoted someone who said :

>
>You want to avoid connecting to the DBMS via ODBC

When you do that, you get twice the overhead.  You can usually find
several JDBC drivers to choose from for any database nowadays.

See http://mindprod.com/jgloss/jdbc.html
for how what type numbers mean and why you would look for a given type
of JDBC driver.

See http://mindprod.com/jgloss/jdbcvendors.html

-- 
Roedy Green Canadian Mind Products
http://mindprod.com
Capitalism has spurred the competition that makes CPUs faster and 
faster each year, but the focus on money makes software manufacturers 
do some peculiar things like deliberately leaving bugs and deficiencies
in the software so they can soak the customers for upgrades later.
Whether software is easy to use, or never loses data, when the company
has a near monopoly, is almost irrelevant to profits, and therefore 
ignored. The manufacturer focuses on cheap gimicks like dancing paper 
clips to dazzle naive first-time buyers. The needs of existing 
experienced users are almost irrelevant. I see software rental as the 
best remedy.

[toc] | [prev] | [next] | [standalone]


#9469

FromArne Vajhøj <arne@vajhoej.dk>
Date2011-11-03 16:59 -0400
Message-ID<4eb300ce$0$289$14726298@news.sunsite.dk>
In reply to#9463
On 11/3/2011 4:04 PM, eAddict wrote:
> First, a bit of background.  I am trying to get UDConnect (a SAP
> product) to work.  This requires a JAVA connection from the HP-UX
> system to a MS SQL server using an ODBC driver.
>
> I looked at the MS knowledge base (http://support.microsoft.com/kb/
> 313100) to see some sample code.  Well, this sample is good if going
> from a MS system to another MS system.
>
> Problem is I don't know/code Java.  I would like to have a simple java
> program on my HP-UX system that tests the ODBC connection the same way
> the MS example does.

<copy src="c.l.j.d">
You should be able to use the same Java program as that example.

Just note that if you get a newer JDBC driver then the connection
URL is slightly different.
</copy>

Arne

[toc] | [prev] | [next] | [standalone]


#9506

FromRoedy Green <see_website@mindprod.com.invalid>
Date2011-11-03 22:07 -0700
Message-ID<ons6b79bi1jpvuo65rdg400s6ahpsfbifl@4ax.com>
In reply to#9463
On Thu, 3 Nov 2011 13:04:41 -0700 (PDT), eAddict <eaddict@gmail.com>
wrote, quoted or indirectly quoted someone who said :

>Problem is I don't know/code Java.  I would like to have a simple java
>program on my HP-UX system that tests the ODBC connection the same way
>the MS example does.

 see http://mindprod.com/jgloss/jdbc.html

It had quite a few examples of how you connect to databases.  They
will give you an idea of what to google for to get a complete example.
-- 
Roedy Green Canadian Mind Products
http://mindprod.com
Capitalism has spurred the competition that makes CPUs faster and 
faster each year, but the focus on money makes software manufacturers 
do some peculiar things like deliberately leaving bugs and deficiencies
in the software so they can soak the customers for upgrades later.
Whether software is easy to use, or never loses data, when the company
has a near monopoly, is almost irrelevant to profits, and therefore 
ignored. The manufacturer focuses on cheap gimicks like dancing paper 
clips to dazzle naive first-time buyers. The needs of existing 
experienced users are almost irrelevant. I see software rental as the 
best remedy.

[toc] | [prev] | [next] | [standalone]


#9556

FromArne Vajhøj <arne@vajhoej.dk>
Date2011-11-04 21:45 -0400
Message-ID<4eb49526$0$295$14726298@news.sunsite.dk>
In reply to#9506
On 11/4/2011 1:07 AM, Roedy Green wrote:
> On Thu, 3 Nov 2011 13:04:41 -0700 (PDT), eAddict<eaddict@gmail.com>
> wrote, quoted or indirectly quoted someone who said :
>
>> Problem is I don't know/code Java.  I would like to have a simple java
>> program on my HP-UX system that tests the ODBC connection the same way
>> the MS example does.
>
>   see http://mindprod.com/jgloss/jdbc.html
>
> It had quite a few examples of how you connect to databases.  They
> will give you an idea of what to google for to get a complete example.

There already were an example for the specific database
in the link in the post.

Additional examples for other databases are not likely to
help.

Arne

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web