• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

UnsuppotedException..user must supply a jdbc connection

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai am getting the above exception in hibernate
here is my code
TestClient.java::


import org.hibernate.cfg.Configuration;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.Session;
import org.hibernate.HibernateException;
import java.io.*;

public class TestClient

{
public static void main(String[] args)
{

Session session=null;

try
{
Configuration cfg=new Configuration();
Configuration cf=cfg.configure("hibernate.cfg.xml");
//create sessionfactory object
SessionFactory factory=cf.buildSessionFactory();
Session ses=factory.openSession();
//persistent logic
JavaBean jb=new JavaBean();
jb.setSno(101);
jb.setFname("aaa");
jb.setLname("bbb");
jb.setMail("s@gmail.com");

Transaction tx=ses.beginTransaction();
below jb is in persistent state
Integer idval=(Integer)ses.save(jb);
System.out.println("id value"+idval);
tx.commit();

ses.close();
factory.close();


}
catch(HibernateException e)
{
e.printStackTrace();
}
}
}
hibernate.cfg.xml::

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hbernate.connection.url">jdbc:oracle:thin:@localhost:1521:xe</property>
<property name="hibernate.connection.username">system</property>
<property name="hibernate.connection.password">hai</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="show_sql">true</property>
<mapping resource="emp.hbm.xml"/>
</session-factory>
</hibernate-configuration>

emp.hbm.xml::

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="JavaBean" table="employee3">
<id name="sno" column="SNO"/>
<property name="fname" column="FNAME"/>
<property name="lname" column="LNAME"/>
<property name="mail" column="MAIL"/>
</class>
</hibernate-mapping>


I am working in standalone apps
can anyone help me to sortout this problem
reply
    Bookmark Topic Watch Topic
  • New Topic