Solved

applet connect to sql server 2000

Posted on 2002-06-03
10
497 Views
Last Modified: 2013-12-29
hi,
I am writing an applet which will connect to sql server 2000 using sql server 2000 driver for jdbc.

here is the error msg:
[Microsoft][SQLServer 2000 Driver for JDBC]Unsupported VM encoding MS950.

How can I solve this?
0
Comment
Question by:klnhk
  • 5
  • 2
  • 2
  • +1
10 Comments
 
LVL 9

Expert Comment

by:Ovi
ID: 7050991
Set the encoding of your connection to another type.
Usually you do this by adding after the datasource (database) name the text : charSet=utf-8 for example.
try {
  Class.forName("my.sql.Driver");
} catch(Exception e) {}

String database = "jdbc:...:127.0.0.1/TEST";
String user="TEST";
String password="test";

Connection con = DriverManager.getConnection(database + "?charSet=utf-8", user, password);
0
 

Author Comment

by:klnhk
ID: 7052915
Thanks.

It shows this error this time?

[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Login failed for user 'stanley'.


When I use Applet to connect to SQL, any security problem?
do all uers need to install JDBC in their pc?

0
 
LVL 9

Expert Comment

by:Ovi
ID: 7053114
Are you sure that your user&password are correct? Be aware of case sensitivity. You could try to test all this stuff locally on your computer with a small APPLICATION and see which are the problems raised. If you can connect to the database server from that appliation, convert'it to a simple applet and resolve eventual sequrity problems.
0
 

Author Comment

by:klnhk
ID: 7053351
Can an applet in Host A connect to a MS SQL db in Host B?
0
 
LVL 9

Accepted Solution

by:
Ovi earned 100 total points
ID: 7053656
Only if is a signed applet. Normally a applet can connect only to the host from where it comes. If this is your problem you have some solutions :

1. Use signed applet.
2. Delegate the query of the database from the applet to the server. By putting a servlet (cgi, jsp, etc.) on the same server as the applet, get's you the possibility to avoid sequrity problems. The applet only requests then some results from that servlet and displays the results. Also this is a good ideea if you think that a "specialized user" of your applet can capture'it and decompile'it. Since sql statements are holded as strings, will be a quick job to find your table structures, database server, user name&password ... and the rest you can imagine. So, in a word, applets are usually used as "views" of a complex system and should provide simple things, based on forwarding the real work to the server. In this way your applet will be very lite and will load very fast.
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 1

Expert Comment

by:jdc0724
ID: 7068161
Since you are using an applet, I would recommend only passing parameters to a servlet running on a server machine.  Using those parameters you would connect to the database (db2, oracle, access, etc) from within the servlet.  You can then pass the data back to the applet for displaying purposes or whatever?  

If you want to use an applet (because maybe there are many users, etc), then I would definitely use the servlet approach to handle your workload.  Also, since the servlet will acess the databases, only the server in which the servlet resides needs to have JDBC.  Anyone with a browser and the appropriate authority can use the application without having to install JDBC.  

However, if you are the only use of this application I would recommend just creating a Java UI application instead of the Applet/servlet combo.  Keep in mind that JDBC would have to be available on whatever pc you have the application installed.

Good luck,
JDC
0
 
LVL 9

Expert Comment

by:Ovi
ID: 7069174
JDC please read the comment above yours ...
0
 
LVL 9

Expert Comment

by:Ovi
ID: 7069177
KLNHC : I believe it's time to take a decision with this question don't you ?
0
 
LVL 1

Expert Comment

by:jdc0724
ID: 7070036
Ovi, although we have similar comments, I believe we each commented on some of the different benefits of using a server side script to handle the workload.  

Cheers,
JDC
0
 
LVL 35

Expert Comment

by:girionis
ID: 8833938
No comment has been added lately, so it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area that this question is:

- points to Ovi

Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

girionis
Cleanup Volunteer
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now