trying to access SQL Server 7.0 from Java through jdbc:odbc

trying to access SQL Server 7.0 from Java through jdbc:odbc

Post by Patrick Flahert » Mon, 19 Jun 2000 04:00:00



Hello,

The following is a thread I started in comp.lang.java.programmer.  I'm reposting
it here since I believe now part of what I need to know is how ODBC interacts
with SQL Server.  The middle part (>>) is my original post, a response is just
above that, and my latest post (where the ODBC stuff is) is at the bottom:


>Patrick:

>I don't know if this will help you, but this might be the scenario.

>If you're running Internet Information Server as the Web server, and
>loading the applet throught the default ( or other ) Web site,
>check the security settings on IIS by right-clicking the web site folder
>and selecting properties ( Windows 2000 ).

>Two settings will matter:  Whether or not your web site allows Anonymous
>Authentication,
>or Basic, etc.

>If IIS has Anonymous access enabled, your browser may be coming in to IIS as
>the IUSR_<machine_name> which is
>the security equivalent to an NT Guest account.   If this is the case, the
>IUSR_<machine_name> account
>probably doesn't have access to your SQL Server.  If you want to open this
>up, add database access
>permissions to your tables for the IUSR_xxx account.

>Since the user/password prompt seems to be jdbc connection
>challenge/response rather than
>NT challenge/response based on your message, I think that your browser is
>represented
>on the Web server as a user you're not expecting in the database.

>Hope this helps out.



>> Hello,

>>   Have written a small, test applet in Java using VisualCafe that
>> I want to run in the browser to access MSSQL 7.0.

>>   The applet runs just fine in VC's AppletViewer.

>>   Then I try running the browser.  The applet loads and I click
>> a button to make a connection and retrieve from the database.
>> Get a dialog that says the following:

>>   URL       jdbc:odbc:Performance_C_test
>>             Username  _______
>>             Password  _______

>> username and password are test entry boxes.

>>   We typically use Windows NT Authorization with MSSQL.
>> But no matter what username and password I use (and they
>> ARE registered in Security | Logins in the db server),
>> the dialog just returns (pops up again) empty with no
>> error message.

>>   Had problems then elsewhere with connecting to MSSQL
>> through jdbc:odbc and found that it was necessary to
>> user SQL Server Authorization.  So then retried my applet
>> in the browser with a valid SQL Server Authorization ID.
>> Still the same behaviour.

>>   Any ideas?  thanx.

>> patrick flaherty

Joel,

  Thanx for your message.

Actually I'm not using IIS or a Web server at all.  I'm running in the context
of my Java IDE, WebGain's VisualCafe (Expert Edition 4.0).  There
are facilities there for running the applet through the Web browser (spawned by
VisualCafe) short of 'deploying' (a VisualCafe term I think ... or maybe not) to
a Web server.

And so it doens't work already at this stage.  I believe later when I deploy
I'll run into signing the applet etc. but I assume that's _not_ my problem now.

One thing I'd like to figure out: who is putting up the dialog I'm seeing now
(and that I described in my first message).  I believe it's jdbc.  And next: why
is it putting it up?  I believe now (since yesterday) that a good part of my
problem is SQL Server (I'm using 7.0).  In my further fumbling around, I've
discovered that SQL Server needs 'trusted' connections ...

Here's an interesting thing I found (although I don't know exactly what it
means).  In VisualCafe, I have to ways to run the application.  Through VC's
AppletViewer (which seems to be a standard feature of Java IDEs) and spawning a
browser.  The browser does not work under any conditions.  And until yesterday,
the AppletViewer _always_ worked (that is, the applet would start up; connect to
the db; and retrieve records; all with no username/password required).

Then yesterday, after I posted my first message, I thought to play around with
the ODBC characterisics.  Under 'Client Configuration' one can choose different
network libraries.  This appears under the Microsoft SQL Server driver and not,
for example, under out ODBC driver that we use to get back to RDB on VMS, so is
presumably a driver characteristic.  The default value is 'Named pipes'.  There
are actually 8 possible choices although I think only 3 are of interest here:
named pipes, TCP/IP and Multiprotocol.  The others are names such as IPX/SPX
(Netware) and AppleTalk (Apple) and that's why I say they're probably not of
interest.

Anyway, the default, which I hadn't touched is named pipes, and this had always
worked through the AppletViewer.  What I found is that for the first time the
AppletViewer _does not work_ when I changed this value to TCP/IP.  I get the
same username/password dialog business that I get when running through the
browser.

So my theory now is that the browser (even thought the ODBC connection is set to
named pipes) somehow dynamically (at run-time that is) goes through TCP/IP. And
this is not 'secure' (that's why one has the secure sockets layer on top of
TCP/IP right?).

  Any ideas on how one can save messsages to an error log from a browser?

  Anyway it's only a theory.

 
 
 

1. Java and JDBC (MS SQL Server 7.0)

Hi y'all.

I've developed a little in MS Visual J++ 6.0, and now i wanted to develop in
"core JAVA", not just Microsoft Java.

I installed Java Cafe 3.0 Pro (was a giveaway on a magazine). It works fine
for my purposes so far.

Now i want to access my MS SQL Server 7.0 (win2k machine). How do i do that
from Java Cafe 3.0 Pro ?

Answers/Samples/Links will be apreciated.

Thanks,

Brian

2. Accessing reserved definitions!

3. Linking Access 7.0 to SQL Server 7.0 tables using ODBC File DSN

4. installing 7.2b3 on IRIX 6.5.13

5. Retrieving output params from stored procedures ODBC-JDBC bridge Java SQL Server

6. JDBC-ODBC for MS SQL Server 7.0?

7. Problem with PreparedStatement with JDK1.2.1, JDBC-ODBC bridge and SQL Server 7.0

8. JDBC-Like pure java class to connect to Ms Sql Server or Ms Access

9. Java executable crashes when using Access ODBC-JDBC

10. Access, Java, Msql, JDBC-ODBC and headaches.