-
1. Re: JBoss configuration for MS Sql 2000 Connection..
kabirkhan Oct 7, 2004 10:24 AM (in response to chetu_75)Post more details about what files you modified, how you are trying to use the data source and any stack traces
-
2. Re: JBoss configuration for MS Sql 2000 Connection..
jboss_oops Nov 5, 2004 1:39 AM (in response to chetu_75)Hi I am also trying to connect to MS SQL Server 2000. I am running JBOSS 3.2.4
My Client code is not able to do the JNDI MApping..
Here Below I am attaching the code which I have in my client code.
import javax.naming.*;
import javax.sql.*;
import java.sql.*;
import java.io.*;
import java.util.*;
class TestJdbcJBoss
{
public static void main(String[] args) throws SQLException,IOException,ClassNotFoundException,NamingException
{
Hashtable ht=new Hashtable();
ht.put(InitialContext.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
ht.put(InitialContext.PROVIDER_URL,"jnp://localhost:1099");
InitialContext ic=new InitialContext(ht);
if(ic!=null)
System.out.println("success11");
DataSource ds=(DataSource)ic.lookup("java:/MSSQLDS");
Connection conn = ds.getConnection();
Statement st=conn.createStatement();
ResultSet rs=st.executeQuery("select * from testbd");
if(rs!=null)
System.out.println("sucess");
while(rs.next())
{
System.out.println(rs.getInt("test"));
}
}
}
This the error I am getting when I run my code
success11
Exception in thread "main" javax.naming.NameNotFoundException: MSSQLDS not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
at org.jnp.server.NamingServer.lookup(NamingServer.java:282)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:536)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:528)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at TestJdbcJBoss.main(TestJdbcJBoss.java:17)
I have done all the settings and configuration has given in the below Link
http://www.onjava.com/pub/a/onjava/2004/02/25/jbossjdbc.html
Please guide me where I am doing wrong..
what all additional changes I have to do?
Please do reply
thanks :)