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

E

eAddict

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
 
L

Lew

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.
 
A

Arne Vajhøj

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
 
A

Arne Vajhøj

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.


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.


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
 
L

Lew

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.
 
A

Arne Vajhøj

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.
If that's all you're doing, sure. Couldn't agree more.

That seems to be what he want.

Arne
 
R

Roedy Green

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.
 
R

Roedy Green

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.
 
A

Arne Vajhøj

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top