SQL Server 2000 - JDBC + Java Applet problem

Hai
I have some problem connecting my SQL server database with Java.
I use Applet to make my interface.
I use Windows 2000 server.
Here is my program listing :
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
import java.sql.*;
public class VLookup extends JApplet {
String database = "jdbc:odbc:Driver={SQL Server};SERVER=Windows2000;uid=sa;pwd=;Database=User-Phone Database";
String user = "sa";
String password = "";
Statement s;
Connection c;
JTextField searchFor = new JTextField(10);
JLabel completion = new JLabel(" ");
JTextArea results = new JTextArea(40, 20);
public void init() {
searchFor.getDocument().addDocumentListener(new SearchL());
JPanel p = new JPanel();
p.add(new Label("ID to search for :"));
p.add(searchFor);
p.add(completion);
Container cp = getContentPane();
cp.setLayout(new BorderLayout());
cp.add(p, BorderLayout.NORTH);
cp.add(results, BorderLayout.CENTER);
try {
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
c = DriverManager.getConnection(database, user, password);
s = c.createStatement();
} catch(Exception e) {
results.setText(e.getMessage());
class SearchL implements DocumentListener {
public void changedUpdate(DocumentEvent e){}
public void insertUpdate(DocumentEvent e){
textValueChanged();
public void removeUpdate(DocumentEvent e){
textValueChanged();
public void textValueChanged() {
ResultSet r;
if(searchFor.getText().length() == 0) {
completion.setText("");
results.setText("");
return;
try {
r = s.executeQuery("SELECT " + "Tipe " + "FROM " + "Time " + "WHERE " + "(Tipe Like '" + searchFor.getText() + "%') "
+ "GROUP BY " + "Tipe " + "ORDER BY " + "Tipe " );
if(r.next())
completion.setText(r.getString("Tipe"));
r = s.executeQuery("SELECT " + "ID_Pengguna, Phone_Number, Tipe " + "FROM " + "Time "
+ "WHERE " + "(Tipe ='" + completion.getText() + "') "
+ "GROUP BY " + "ID_Pengguna, Phone_Number, Tipe "
+ "ORDER BY " + "ID_Pengguna, Phone_Number " );
} catch(Exception e) {
results.setText(searchFor.getText() + "\n");
results.append(e.getMessage());
return;
results.setText("");
try {
while(r.next()) {
results.append(r.getString("ID_Pengguna") + ", " + r.getString("Phone_Number") + ", " + r.getString("Tipe") + "\n");
} catch(Exception e) {
results.setText(e.getMessage());
public static void main(String[] args) {
JApplet applet = new VLookup();
JFrame frame = new JFrame("User ID");
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e){
System.exit(0);
frame.add(applet);
frame.setSize(500, 200);
applet.init();
applet.start();
frame.setVisible(true);
} ///:~
And java catch error like this : access denied (java.lang.RuntimePermission access ClassInPackage.sun.jdbc.odbc)
What is wrong ??
Is there any problem with my DNS ? 'cos I don't know how to set up my DNS.
Can u help my with this problem ??
Thank's

You need to read up on what applets are capable of. Applets generally cannot open connections to things like databases due to sandboxing. There are a couple of ways to get around this. The applet can connect to a servlet on the same machine from which it came and have the servlet do the database accesses. Alternately, you can create a signed applet which allows you to get around some of these sandboxing issues.If tried to make localhost on my computer ( by setting my IIS configuration setting, and using Configure SQL XML Support in IIS I've created a new http://localhost/skripsi to my SQL database.
Is there any command that I have to add to my program listing so the applet can work as I wish ??
Is there any way to use applet to connect my database withaout using servlet, and can u explain siggned applet to mey ??
Sorry, I don't really know java very well.
driver type 4 ??

Similar Messages

  • Java Web Server 6.1 & Pooled SQL Server 2000 JDBC Connections

    If anyone can shed some light on this problem I would greatly appreciate it.
    I am unsuccessfully trying to use a database connnection retrieved from a pool configured using Java System Web Server 6.1 with the SQL Server 2000 JDBC Driver.
    The background:
    1. I have downloaded the SQL Server 2000 JDBC Driver and installed it on the web server.
    2. I used the Administration GUI to add the .jars(namely msbase.jar, msutil.jar, and mssqlserver.jar), to the classpath.
    3. Upon creating a simply JSP to access connection metadata using the direct connect method, ie.,
    Class.forName( com.microsoft.jdbc.sqlserver.SQLServerDriver);
    Connection con = DriverManager.getConnection( "jdbc:microsoft:sqlserver:// ....
    I am shown a successful output of...
    JDBC Test
    Registering JDBC Driver
    driverClass: com.microsoft.jdbc.sqlserver.SQLServerDriver loaded and registered.
    Driver Information
    Driver Name: SQLServer
    Driver Version: 2.2.0037
    Database Information
    Database Name: Microsoft SQL Server
    Database Version: Microsoft SQL Server 2000 - 8.00.760 (Intel X86) Dec 17 2002 14:22:05 Copyright (c) 1988-2003 Microsoft Corporation Enterprise Edition on Windows NT 5.2 (Build 3790: )
    Avalilable Catalogs
    catalog: master
    catalog: msdb
    catalog: Northwind
    catalog: pubs
    catalog: tempdb
    4. This tells me that the web server has access to the files necessary and the classpath is configured correctly.
    Now the fun begins...
    In order to set up the JDBC Connection Pool I have done the following...
    1. I have created a web.xml file for the web-app which contains the JSP and includes the following entry
    <resource-ref>
    <res-ref-name>jdbc/devjwscp</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    2. I have used the "JDBC Connection Pools" link under the "Java" tab in the Administration GUI to create a connection pool.
    "Pool Name:" is "devjwscp"
    "DataSource Classname" is set to "com.microsoft.jdbcx.sqlserver.SQLServerDataSource". All other properties have been left alone.
    3. I have used the "JDBC Resources" link under the "Java" tab in the Administration GUI to create a JNDI resource.
    "JNDI Name" is set to "jdbc/devjwscp"
    "Status" is "true"
    "Pool Name" is "devjwscp"
    The web-app JSP comes back with the following exception.
    JDBC Test
    Exception Thrown
    Cannot create resource instance
    javax.naming.NamingException: Cannot create resource instanceorg.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:167)
    javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:301)
    org.apache.naming.NamingContext.lookup(NamingContext.java:834)
    org.apache.naming.NamingContext.lookup(NamingContext.java:181)
    org.apache.naming.NamingContext.lookup(NamingContext.java:822)
    org.apache.naming.NamingContext.lookup(NamingContext.java:181)
    org.apache.naming.NamingContext.lookup(NamingContext.java:822)
    org.apache.naming.NamingContext.lookup(NamingContext.java:181)
    org.apache.naming.NamingContext.lookup(NamingContext.java:822)
    org.apache.naming.NamingContext.lookup(NamingContext.java:194)
    org.apache.naming.SelectorContext.lookup(SelectorContext.java:183)
    javax.naming.InitialContext.lookup(InitialContext.java:347)
    _jsps._jdbctest_jsp._jspService(_jdbctest_jsp.java:236)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
    com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.service(JspServlet.java:667)
    com.iplanet.ias.web.jsp.JspServlet.serviceJspFile(JspServlet.java:447)
    com.iplanet.ias.web.jsp.JspServlet.service(JspServlet.java:363)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
    org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:771)
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:322)
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:209)
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
    com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:161)
    com.iplanet.ias.web.WebContainer.service(WebContainer.java:586)
    4. FYI my server.xml <RESOURCE> entry looks as is shown below
    <RESOURCES>
    <JDBCCONNECTIONPOOL name="devjwscp" datasourceclassname="com.microsoft.jdbcx.sqlserver.SQLServerDataSource" steadypoolsize="8" maxpoolsize="32" poolresizequantity="2" idletimeout="300" maxwaittime="60000" connectionvalidationrequired="off" connectionvalidationmethod="auto-commit" validationtablename="" failallconnections="off" transactionisolationlevel="read-uncommitted" isolationlevelguaranteed="off">
    <PROPERTY name="serverName" value="secret"/>
    <PROPERTY name="portNumber" value="1433"/>
    <PROPERTY name="User" value="secret"/>
    <PROPERTY name="Password" value="secret"/>
    </JDBCCONNECTIONPOOL>
    <JDBCRESOURCE jndiname="jdbc/devjwscp" poolname="devjwscp" enabled="on"/>
    </RESOURCES>
    What gives? Do I need to add anything else to the server.xml? I know the server.xml for JWS differs from Apache. I have done an exhaustive search of the web. Many other individuals have had the same thing happen, buy none of them offered any explaination or remedy.
    Thanks in advance.

    Hi,
    Were you able to get it working.
    I am using
    Sun ONE Web Server 6.1SP2 B04/07/2004 18:47
    I am still getiing the same error. I also suspect that there is something wrong with thr DTD too. It gives me the following when the server comes up.
    Sun ONE Web Server 6.1SP2 B04/07/2004 18:47
    Listening for transport dt_socket at address: 1699
    info: CORE5076: Using [Java HotSpot(TM) Server VM, Version 1.4.2_04] from [Sun M
    icrosystems Inc.]
    info: WEB0100: Loading web module in virtual server [https-AW-NYNY-D609628.nna.
    wdpr.disy.com] at [acsanet]
    info: WEB0100: Loading web module in virtual server [https-AW-NYNY-D609628.nna.
    wdpr.disy.com] at [testing]
    failure: WEB0120: XML error parsing deployment descriptor [C:/Sun/WebServer6.1/h
    ttps-AW-NYNY-D609628.nna.wdpr.disy.com/webapps/https-AW-NYNY-D609628.nna.wdp
    r.disy.com/testing/WEB-INF/sun-web.xml]
    Failed to create the XML-DOM Document. Check your XML to make sure it is correc
    t.org.xml.sax.SAXParseException: Character conversion error: "Unconvertible UTF-8
    character beginning with 0xa0" (line number may be too low).
    at org.apache.crimson.parser.InputEntity.fatal(InputEntity.java:1100)
    at org.apache.crimson.parser.InputEntity.fillbuf(InputEntity.java:1072)
    at org.apache.crimson.parser.InputEntity.isXmlDeclOrTextDeclPrefix(Input
    Entity.java:914)
    at org.apache.crimson.parser.Parser2.maybeXmlDecl(Parser2.java:1183)
    at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:653)
    at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
    at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
    at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl
    .java:185)
    at org.netbeans.modules.schema2beans.GraphManager.createXmlDocument(Grap
    hManager.java:711)
    at org.netbeans.modules.schema2beans.BaseBean.createGraph(BaseBean.java:
    2075)
    at com.iplanet.ias.web.WebContainer.loadWebModule(WebContainer.java:695)
    at com.iplanet.ias.web.WebContainer.loadStandaloneWebModule(WebContainer
    .java:626)
    at com.iplanet.ias.web.WebContainer.loadWebModules(WebContainer.java:600)
    at com.iplanet.ias.web.WebContainer.createVS(WebContainer.java:374)
    at com.iplanet.ias.server.J2EERunner.createVS(J2EERunner.java:223)
    info: WEB0100: Loading web module in virtual server [https-AW-NYNY-D609628.nna.wdpr.disy.com] at [search]
    config: HTTP4292: flex-init: Log file C:/Sun/WebServer6.1/https-AW-NYNY-D609628.
    nna.wdpr.disy.com/logs/access should be removed before changing its format
    info: HTTP3072: [LS ls1] http://AW-NYNY-D609628.nna.wdpr.disy.com:80 ready to
    accept requests
    startup: server started successfully
    info: CORE3274: successful server startup
    the sun-web.xml is as below:
    <?xml�version="1.0"�encoding="UTF-8"?>
    <!--
         Copyright 2002 Sun Microsystems, Inc. All rights reserved.
    -->
    <!DOCTYPE�sun-web-app�PUBLIC�"-//Sun�Microsystems,�Inc.//DTD�Application�Server�8.0�Servlet�2.4//EN"�"http://www.sun.com/software/appserver/dtds/sun-web-app_2_4-0.dtd">
    <sun-web-app>
         <resource-ref>
              <res-ref-name>jdbc/oraclePool</res-ref-name>
              <jndi-name>jdbc/oraclePool</jndi-name>
         </resource-ref>
    </sun-web-app>
    Am I using the right DTD ?
    Please let me know.
    Thank you.
    -- Martin Louis

  • SQL server 2000 with Java Problems

    Dear Sir.
    I am a new user for SQL server 2000 with java. Nevertheless, I developed an application for store images and text data into SQL 2000 database using java. Presently my system is running 12-client computer with one server computer, I installed SQL server 2000 into server then I access (save, insert, select, and get report) through ODBC diver to server using java application, system is ok but some time the server computer is getting struck.
    Please let me know if there is a solution to overcome this problem.
    My client computer configuration
    Windows xp
    1.8 MHz CPU � 512 � 768 RAM
    My Server computer configuration
    3.0 Dual core Intel - 1 GB RAM
    Window 2000 server

    but some time the server computer is getting struck.Can you measure which application is eating up the resources? Anyway, the hardware sounds OK for that number of clients, but of course it depends on the intensity they work with.
    The suspicious part is the ODBC driver. Is there a reason not to use the JDBC driver for SQL server provided by microsoft? I guess it will speed things up.
    Mike

  • Where to find the API documentation for MS SQL Server 2000 JDBC

    I Downloaded and installed the MS SQL Server 2000 JDBC package, but I found that it does not provide enough help docs such as API documentation, demo and etc.
    It would be most grateful if you would provide some information about this driver.

    Thank your for your kind attention.
    For example, I want to get a ConnectionPoolDataSource object to get a PooledConnection object, but I don't know which class implements the interface.
    import java.sql.*;
    import javax.sql.*;
    import <classes related to connection pooling>;
    ConnectionPoolDataSource cpds = new <MS impl>;
    <lines for setURL()/setUser()/setPassword, etc>
    PooledConnection pc = cpds.getPooledConnection();
    ...

  • SQL Server 2000 Jdbc connection

    I just have a small question and I was wondering if anyone could help me out with it? I'm using a JSP page to connect up to the database on the server. I have the JDBC driver and am trying to connect from my machine to SQL Server 2000 on our server. The thing is I'm having a little trouble with the connection string.
    (i am using the Microsoft SQL Server 2000 JDBC Driver)
    Can you use Windows Authentication when using the connection string?
    Also i tried using a SQL Server connection but it gave me the error : "com.microsoft.sqlserver.jdbc.SQLServerExcepti on: Login failed for user 'Arun'. The user is not associated with a trusted SQL Server connection. "
    This is the connection string
    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
    Connection connection1 = java.sql.DriverManager.getConnection("jdbc:sqlserver://localhost:1433;Database=BusinessDatabase","Arun","testpass");can you set it up for windows authentication?
    thanks for any help anyone can give me with this! <img src="http://www.java-forums.org/images/smilies/smile.gif" border="0" alt="" title="Smile" width="16" height="16" />

    Hi,
    Yes, it is possible to use Windows Authentication but you will need to make sure the sqljdbc_auth.dll file is in your system path specified with the -Djava.library.path="xxx" option. The dll is included as part of the JDBC Driver download.
    Hope this helps.
    Ben.

  • MS SQL Server 2000 JDBC Driver + Tomcat 4

    Will the MS SQL Server 2000 JDBC Driver (http://www.microsoft.com/SQL/downloads/2000/jdbc.asp) work with a JSP application on the Tomcat Server. The JSP is to access a MS SQL Server Database. Would it b able to do this with this Driver or do I need another one (type) for Tomcat?
    Thanx
    Yaz

    Hi Yasir,
    1. It should be OK.
    (2. Check the requirement to see if you have everything)
    --Paul.                                                                                                                                                                                           

  • MS SQL Server 2000 JDBC driver and databasename

    Hi,
    I have tried to switch from using WebLogic jDriver for MS SQL Server to using
    MS SQL Server 2000 JDBC Driver as recommended by Bea for WebLogic 7.0. I can get
    the connection pooling to work with the new driver but I cannot get it to work
    for certain database. It seems to always connect to the defaul database even though
    I specify the database in console with property databasename=DBNAME. Any ideas
    what could be wrong?
    Thanks!
    Cheers,
    Jouni

    We had this working fine with WLS7, this is the entry from our config.xml
    <JDBCConnectionPool DriverName="com.microsoft.jdbc.sqlserver.SQLServerDriver"
    InitialCapacity="50" MaxCapacity="50" Name="SQLServerConnectionPool" Password="{3DES}UkODkM1JaCU="
    Properties="user=Destin8;SelectMethod=cursor;databaseName=Destin8V3" ShrinkingEnabled="false"
    Targets="Destin8Cluster1" URL="jdbc:microsoft:sqlserver://mcp1:1433"/>
    Hope this helps..
    Pete
    "Jouni Peltonen" <[email protected]> wrote:
    >
    Hi,
    I have tried to switch from using WebLogic jDriver for MS SQL Server
    to using
    MS SQL Server 2000 JDBC Driver as recommended by Bea for WebLogic 7.0.
    I can get
    the connection pooling to work with the new driver but I cannot get it
    to work
    for certain database. It seems to always connect to the defaul database
    even though
    I specify the database in console with property databasename=DBNAME.
    Any ideas
    what could be wrong?
    Thanks!
    Cheers,
    Jouni

  • MS SQL Server 2000 + JDBC

    Hi everyone,
    I know many of you don't like microsoft products, but I am getting weird errors when i connect my java program to SQL server 2000 with its driver. My code worked FINE with MS Access. The thing is I know there are some bugs to SQL server driver , and somebody knowledgeable with this software could def help me fix the problem, but i searched all over the microsoft site, couldnt find a fix to my problem, and contacting microsoft for help costs between $195-$245. I was wondering if somebody here is familiar with this software. I would really appreciate it if you could email me at [email protected] I will post all of the problem here also.
    I'm getting the following error when i try to create a insert a new function (create a new row) in my database:
    [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Incorrect syntax near the keyword 'Function'.
    Here is the relevant code:
    <code>
    try{
    DriverManager.registerDriver(new com.microsoft.jdbc.sqlserver.SQLServerDriver() );
    } catch (Exception e) {
    System.out.println(e.getMessage());
    try{
    Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://NJ8650MONDAL", "m", "m");
    con.setAutoCommit(false);
    PreparedStatement insertFvalues = con.prepareStatement("INSERT INTO function_description (Function, Description, Notes) VALUES (?,?,?)");
    insertFvalues.setString(1,functionname);
    insertFvalues.setString(2,descriptionname);
    insertFvalues.setString(3,notesname);
    insertFvalues.execute();
    PreparedStatement insertRvalues = con.prepareStatement("INSERT INTO return_code_description (Function_Name, Return_Codes, Return_Codes_Description) VALUES (?,?,?)");
    insertRvalues.setString(1,functionname);
    insertRvalues.setString(2,rvvaluesname);
    insertRvalues.setString(3,rvdescripname);
    insertRvalues.close();
    con.commit();
    insertFvalues.close();
    insertRvalues.close();
    con.close();
    } catch (SQLException e) {System.out.println(e.getMessage());
    }</code>

    thanks. i fixed that error, so now that portion works. however, i have a question..
    SQL server does not allow comparisons between text fields unless the IS NULL or LIKE operators are used. I'm using JDBC to load exisiting entries from the database and display them in a gui. THe thing is I have one main table, which has a one-to-many relationship with my other tables..so the way i linked them was to have one column in each table hold the same text data, and then i can use the = operator to see if there are matches..
    for example one table (function_description) has the following data:
    Function_Name_Ind Description Notes
    sample blah blah
    And another table (return_code_description)has the following data:
    Function_Name Return_Code Return_Code_Description
    sample x xx
    sample y yy
    And I want all of this displayed.
    i don't know if that explanaiton is any good, but seeing the code below might help you understand..
    <code>
    try{
    Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://NJ8650MONDAL", "m", "m");
    con.setAutoCommit(true);
    Statement stmt = con.createStatement();
    ResultSet result = stmt.executeQuery("SELECT * FROM function_description, return_code_description " + "WHERE function_description.Function_Name_Ind = return_code_description.Function_Name AND (((Function_Name_Ind)='"+ functionname + "'))");
    result.next();
    function.setText(result.getString("Function_Name_Ind"));
    description.setText(result.getString("Description"));
    notes.setText(result.getString("Notes"));
    rvalues.setText(result.getString("Return_Codes"));
    rvdescrip.setText(result.getString("Return_Codes_Description"));
    stmt.close();
    con.close();
    } catch (SQLException e) {System.out.println(e.getMessage());
    </code>
    And i'm getting this error.
    [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.
    Can any of you think of another way I can do this? IS there another way in JDBC I can write it?
    thanks!

  • MS SQL Server 2000 + tomcat 5.5  problem

    hi,
    i'm working with netbeans 5.5, ms sql server 2000 and servlets (mvc without frameworks). When i launch my webapp with netbeans, with bundled tomcat 5.5, it works fine but when i export and deploy it under an independent tomcat (5.5 too) it crashes:
    java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specifiedi've tried both Microsoft official drivers (even with service pack 3) and jtds to no avail.
    Here's my code:
    CONTEXT.XML
    <Resource name="jdbc/ds_arb" auth="Container"    type="javax.sql.DataSource"
    driverClassName="net.sourceforge.jtds.jdbc.Driver"      url="jdbc:jtds:sqlserver://localhost:1433;databaseName=parb;user=user;password=pwd"/>
    </Context>
    JAVA CODE
    Context initCtx = new InitialContext();
    Context dBCtx = (Context) initCtx.lookup("java:comp/env");
    ds = (DataSource) dBCtx.lookup("jdbc/ds_arb");
    jars (both in Web-inf\lib in webapp and commons\lib in tomcat)
    msbase.jar
    mssqlserver.jar
    msutil.jar
    jtds-1.2.1.jar
    commons-dbcp, and, of course,
    commons: beanutils, collections, lang & loggingii did everything: registered the classpath (with ms drivers), checked for typos, too short names, to long names, whitespaces, made sure jars were in WEB-INF\LIB and both in commons\lib, even copied commons\lib from bundled tomcat to the independent tomcat.
    Besides, if i change type, in context.xml, to
    net.sourceforge.jtds.jdbcx.JtdsDataSourceand/or add factory property
    factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
    or
    net.sourceforge.jtds.jdbcx.JtdsObjectFactory
    this time netbeans' tomcat doesn't find their classes even when they are in commons lib and webinf-lib
    I've searched over and over and nothing works, as far as it seems, this is a quite common problem with no clear solution; but what puzzles me most is why under netbeans everything works smoothly and under an independent tomcat, which, i must insist, is the same version of the bundled one, it's such a nightmatre?
    Thanks for your time and help

    Hi,
    useful Links
    http://confluence.atlassian.com/display/CONFEXT/SQL+Plugin
    http://www.servlets.com/archive/servlet/SummarizeList?listName=tomcat-user&by=subject&count=196815&paged=false

  • Sql server 2000 JDBC driver

    I installed the Jdbc driver for sql server 2000 and set the classpath. When when I was trying to
    connect to the sql server database from a java program, I kept getting the following error;
    There was an error connecting to the DataSource: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Login failed for user 'jet123'. Reason: Not associated with a trusted SQL Server connection.
    The whole scenario is like this:
    I have a sql server 2000 installed in my windows 2000 machine, and I created a MISM\myBase server under the SQL Server group, where MISM is the name of my machine, and myBase is the name of the sql server. Under the MISM\myBase server I created a database named "Aromatherapy". I added new login(username:jet123, passwd:1001) to the MISM\myBase server and also added user jet123 to the Aromatherapy database. The login(jet123, 1001) is my user name and passwd to my windows machine and has the administrator privillege.
    Here is the code:
    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
    Connection connection = DriverManager.getConnection("jdbc:microsoft:sqlserver://128.2.76.102:1433;databasename=Aromatherapy;user=jet123;password=1001");
    Could anyone help?
    Thanks,
    David

    make sure that user jet123 access to the sql server used by ms-sql queryanlayzer
    not?
    first check if your sql authentication mode is windows and sql server
    or, allow the permistion to jet123 to access the database, by ordinary to be db_owner.

  • Store&read chinese characters in MS SQL server 2000 using Java

    Hi,
    I have a problem to store Chinese characters in MS SQL Server 2000, storing question marks(??????) instead of Chinese characters
    I am using JSF framework, SUN APPLICATION Server 9.1 , MS SQL Server 2000 server and Microsoft data source driver class (com.microsoft.sqlserver.jdbc.SQLServerDataSource) to connect db.
    I have one solution:
    IN JSP:
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    and
    In database column type should “nvarchar” in place of varchar
    while inserting or updating the same need to add ‘N’ prefix with the value like insert into client(Name, Id ….) values (N+)
    the above is working fine but the problem is here i have already defined database with 100s of tables I cant change database tables as well as queries
    Thanks,
    Sathi

    I don't know any betterer option, than to copy the database tabels redefining the Chinese data fields as nvarchar.
    To be frank I had also problems writing to a html file Chinese text stored in MS SQLServer 2000 nvarchar fields.
    The following worked:'
         public String getEncodedData(ResultSet resultSet, int columnIndex, String charset)
         throws SQLException
              //final String methodName = "getEncodedData";
              InputStream binaryStream =resultSet.getBinaryStream(columnIndex);
              String readStringFromStream=readStringFromStream(binaryStream, charset);//UTF_16LE);
              return readStringFromStream;
         public String readStringFromStream(InputStream inputStream, String charset) {
              final String methodName = "readStringFromStream";
              StringBuffer buffer = new StringBuffer();
              try {
                   int ch;
                   InputStreamReader isr = new InputStreamReader(inputStream, charset);
                   Reader in = new BufferedReader(isr);
                   while ((ch = in.read()) > -1) {
                        buffer.append((char)ch);
                   in.close();
                   return buffer.toString();
              } catch (IOException exception) {
                   Log.printError(this,methodName, exception);
                   return null;
         }And writing it to file:
         public void writeEncodedStringToFile(String text, String filePath, String charset, boolean append){
              final String methodName = "writeEncodedStringToFile";
              OutputStreamWriter writer= null;
              try {
                   FileOutputStream fileOutputStream = new FileOutputStream(filePath, append);
                   writer = new OutputStreamWriter(fileOutputStream, charset);
                   writer.write(text);
              } catch (IOException exception) {
                   Log.printError(this,methodName, exception);
              }finally{
                   try {
                        writer.close();
                   } catch (IOException exception) {
                        Log.printError(this,methodName, exception);
         }Edited by: astlanda on Feb 10, 2009 11:13 PM
    Edited by: astlanda on Feb 10, 2009 11:21 PM

  • MS SQL Server 2000 JDBC files

    Hi,
    Im trying to get my java program to connect to MSSQL but the drivers dont want to work.
    Basically what I did is installed the drivers from MS, and also tried to set Classpath to
    C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\
    But it doesnt work. Is there anything I should know besides this? Also can someone please give me sample code to send and recieve data? It is so hard to find a simple working code online.
    Thanks

    Hi,
    Im trying to get my java program to connect to MSSQL
    but the drivers dont want to work.
    Basically what I did is installed the drivers from
    MS, and also tried to set Classpath to
    C:\Program Files\Microsoft SQL Server 2000 Driver for
    JDBC\lib\Install and CLASSPATH aren't going to cut it. Use "java -classpath <path to JAR>" YourClass to run on the command line. If it's a Java EE app, put the JAR in the appropriate place (e.g., WEB-INF/lib for web apps).
    %

  • Discoverer 3.1.36 with SQL Server 2000 via ODBC..Problem!!!!

    We are trying to install Oracle Discoverer 3.1.36 EUL on to SQL Server 2000. We are getting a error while creation of EUL.
    "Installation started on 02-03-27 15:27:24
    Creating tables and views...
    Populating tables with default data...
    Install failed, cause : [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'SUID'.
    CREATE VIEW EUL_ODBC_SCHEMAS AS SELECT NAME AS 'os_schema_name' FROM SYSUSERS WHERE SUID > 1 AND UID <> GID
    Please help
    Regards and Thanks in advance
    Dheeraj

    Thanx for ur cooperation. I have solved the problem. Actually I was using Eclipse SDK but for get to Add external Jar files. In which I need to add the JAR files in the lib directory of Driver's Home Directory
    Thanx...

  • MS SQL Server 2000 JDBC Settings

    Hi,
    I am new to weblogic and i am developing my final year project using weblogic 8.1 SP 3.0. I want to use MS SQL Sever as a database. Can anyone tell me how to configure MS SQL Server for weblogic and how to communicate with it with the help of an example. I have tried my best to configure it by searching material but it is not working. Please help. You can also send me the reply on my email id i.e [email protected]
    Regards,
    SameeR.

    Deepak Vohra wrote:
    Thanks for trying to help, but this below is unnecessary and counter-productive.
    WebLogic comes already with a comprehensively superior JDBC driver for MS SQLServer
    (2000 and up). Just follow the documentation at:
    http://e-docs.bea.com/wls/docs81/jdbc_drivers/mssqlserver.html#1043185
    Joe
    To configure WebLogic with SQL Server:
    1. Install the SQL Server with SQL2kdesksp3.exe
    2. Add the SQL Server driver jar files msbase.jar, msutil.jar and mssqlserver.jar to the Classpath in the startWebLogic script.
    3. In the administration console configure a new JDBC connnection. In the Configure a JDBC Connection Pool frame select MS SQL Server in the Database Type field. Select Microsoft???s MS SQL Server Driver (Type 4 ) driver as the Database Driver.
    4. In the Connection Properties frame specify the Host Name as localhost, Port as 1433, Database User Name as sa and Password as the password used login to the database.
    5. In the Test database connection frame specify the Driver Classname as com.microsoft.jdbc.sqlserver.SQLServerDriver, URL as jdbc:microsoft:sqlserver://localhost:1433
    6. In the Create and deploy frame select the server to which the JDBC Connection pool is to be deployed.

  • SQL server 2000 and java

    Hi all,
    i am about to developpe a java application that has to do the following tasks:
    1. detect all SQL server existing databases .
    2. for every database (SQL server database) be able to connect to the chosen database and detect all the tables Regarding every SQL server database.
    for the first point ,i thought about searching my hole system for the files of SQL server databases with the criteria of its extension (.SQL serverEXtension database file). But i don't know if this method is efficient and if there are not other methods for this purpose ?!
    for the second point i'm wondering if there exist methods or Classes that return the Set of all the tables within a given SQL server database ; and also return the Set of the Fields (Attributes )within this given database.
    It remains one important point: how to connect to a SQL Server database from a java Program.
    I'm waiting for your hints and ideas... Thanks indeed.

    Try DatabaseMetaData for databases, tables and fields. There's even more information you can get from it, check the API documentation.
    Alin.

Maybe you are looking for