| Author |
unable to connect to sql server 2000 thru weblogic
|
krish reddy
Greenhorn
Joined: Sep 09, 2005
Posts: 10
|
|
hi here is the code im getting the same error no matter what. ive set the class path, and included jar files in the weblogic/bin directory ive tried all day and about to Can somebody please help me with this i m new to jdbc [added code tags] [ January 28, 2006: Message edited by: Jeanne Boyarsky ]
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26168
|
|
Krish, What error are you getting? When you start up the server, is the datasource binding successfully? This may be a weblogic question, but we can move it to the weblogic forum later after we see how the problem goes.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
krish reddy
Greenhorn
Joined: Sep 09, 2005
Posts: 10
|
|
yes the datasource in binding, ive created and deployed datasource without any errors. here is the error message i recieve when i compile the above program ------------------------------------------------------------------------ javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.WLIntialContextFactory [Root exception is java.lang.ClassNotFoundException: weblogic.jndi.WLIntialContextFactory] at javax.naming.spi.NamingManager.getInitialContext(Unknown Source) at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source) at javax.naming.InitialContext.init(Unknown Source) at javax.naming.InitialContext.<init>(Unknown Source) at sq4.main(sq4.java:18) Caused by: java.lang.ClassNotFoundException: weblogic.jndi.WLIntialContextFactory at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source) ... 5 more -------------------------------------------------------------------------- i think its a classpath problem
|
 |
krish reddy
Greenhorn
Joined: Sep 09, 2005
Posts: 10
|
|
hi i solved the problem by including sqldriver.jar, but now its show this error java.lang.UnsupportedClassVersionError: sq4 (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) im using jdk 1.5 im not sure what to do
|
 |
Roger Chung-Wee
Ranch Hand
Joined: Sep 29, 2002
Posts: 1683
|
|
|
Note that WebLogic Server < 9.0 does not support Java 1.5.
|
SCJP 1.4, SCWCD 1.3, SCBCD 1.3
|
 |
krish reddy
Greenhorn
Joined: Sep 09, 2005
Posts: 10
|
|
Properties pros = new Properties(); pros.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory"); pros.put(Context.PROVIDER_URL,"t3://localhost:7001"); System.out.println("Connecting to webserver..."); Context conx = new InitialContext(pros); System.out.println("looking up jndi name"); DataSource ds = (DataSource)conx.lookup("coolie"); System.out.println("jndi name found"); System.out.println("Connecting to sql server"); Connection conn = ds.getConnection(); System.out.println("Connection got.."); //Statement stmt = conn.createStatement(); //System.out.println("Creating table"); //stmt.execute("Create table Student(name varchar(20))"); //System.out.println("Table created"); System.out.println("Inserting into table"); PreparedStatement pstmt = conn.prepareStatement("insert into table Student(name values(?))"); pstmt.setString(1,"Thilak"); pstmt.addBatch(); pstmt.setString(2,"san"); pstmt.addBatch(); ok ive got the program to run. But it gets stuch at ds.getConnection()and does nothing
|
 |
 |
|
|
subject: unable to connect to sql server 2000 thru weblogic
|
|
|