JDBC to Microsoft SQL

B

bunka.munka

Hi !

I am experiencing some problems with MSSQL (ver 8.0).

While I can execute sub-select statement directly on a MSSQL server,
I cannot do the same thing in JDBC.

Like the following statement( JDBC throws exception about mismatched
type)

select idcolumn,a,b,c FROM mytable WHERE idcolumn = (SELECT max
(idcolumn) FROM mytable

I could get the result other way too (like top 1 and descend sort
etc..), but this would be the fastest way and I want to use it.


I am connecting to database server without any settings, just IP,
username and password.

On mysql, I had a several options I could specify in a connect string,
so the server acts different.

Is there any setting I can specify which can help me ? Where can I
read all parameters I can specify when connecting via JDBC to Microsoft
SQL ?

Thx.
 
R

Rhino

Hi !

I am experiencing some problems with MSSQL (ver 8.0).

While I can execute sub-select statement directly on a MSSQL server,
I cannot do the same thing in JDBC.

Like the following statement( JDBC throws exception about mismatched
type)

select idcolumn,a,b,c FROM mytable WHERE idcolumn = (SELECT max
(idcolumn) FROM mytable

I could get the result other way too (like top 1 and descend sort
etc..), but this would be the fastest way and I want to use it.


I am connecting to database server without any settings, just IP,
username and password.

On mysql, I had a several options I could specify in a connect string,
so the server acts different.

Is there any setting I can specify which can help me ? Where can I
read all parameters I can specify when connecting via JDBC to Microsoft
SQL ?

Thx.

Your question may be better suited to comp.lang.java.databases than
comp.lang.java.programmer. One of the many SQL Server newsgroups over at
Microsoft might also be a good place to ask this if you don't get any good
answers under comp.lang.java.*.

Then again, maybe someone here will have the answer at his/her fingertips
:)

Rhino
 
J

jon martin solaas

While I can execute sub-select statement directly on a MSSQL server,
I cannot do the same thing in JDBC.

Like the following statement( JDBC throws exception about mismatched
type)

select idcolumn,a,b,c FROM mytable WHERE idcolumn = (SELECT max
(idcolumn) FROM mytable

I suppose it is not because of the missing right parenthesis enclosing the
inner select statement? It's just a typo in your posting, right?
Is there any setting I can specify which can help me ? Where can I
read all parameters I can specify when connecting via JDBC to Microsoft
SQL ?

I suppose that depends on which driver you use... Try to read the manual
(sic). Maybe someone know if you post the actual driver you use, iNet,
Microsofts own etc.

A driver that doesn't support subselect sounds basically flawed. I can't
really imagine why someone would make a driver parameter to turn off
subselects either, and especially have it behave that way per default
sounds really weird.
 
G

Guest

Your question may be better suited to comp.lang.java.databases than
comp.lang.java.programmer. One of the many SQL Server newsgroups over at
Microsoft might also be a good place to ask this if you don't get any good
answers under comp.lang.java.*.

Then again, maybe someone here will have the answer at his/her fingertips
:)

Rhino
Hm, I am getting old :) I had stucked with the current subscribed
newsgroups for a long time, so I didn't reallize I can find more
appropriate one :)

Thx.
 

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

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top