• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

unable to connect to sql server 2000 thru weblogic

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
author & internet detective
Posts: 40913
840
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
krish reddy
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note that WebLogic Server < 9.0 does not support Java 1.5.
 
krish reddy
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic