[hibernate-issues] [Hibernate-JIRA] Commented: (HBX-1190) java.sql.SQLException: No suitable driver found for jdbc:sqlserver://localhost:1433/tempdb
Sandeep M (JIRA)
noreply at atlassian.com
Thu Sep 8 13:21:05 EDT 2011
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-1190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43481#comment-43481 ]
Sandeep M commented on HBX-1190:
--------------------------------
Hi,
I am using below mentioned URL and it is working.
jdbc:sqlserver://localhost:1433;database=mydb
It connects to SQL server 2005 but it is not creating the table and its data in SQL server.
Below is my code:
------------------------------------------------------------------------------------------------------
I)
importjavax.persistence.Entity;
importjavax.persistence.Id;
@Entity
public class Employee {
private int id;
private String names;
@Id
public int getId() {
return id;
}
public void setId(int id) {
System.out.println("IDset");
this.id = id;
}
public StringgetNames() {
return names;
}
public void setNames(Stringnames) {
System.out.println("nameset");
this.names = names;
}
}
II)
importorg.hibernate.SessionFactory;
importorg.hibernate.cfg.AnnotationConfiguration;
importorg.hibernate.tool.hbm2ddl.SchemaExport;
public class TestEmployee {
/**
* @param args
*/
public static void main(String[]args) {
// TODOAuto-generated method stub
new TestEmployee();
}
public TestEmployee(){
// TODOAuto-generated constructor stub
AnnotationConfiguration cfgg= newAnnotationConfiguration();
cfgg.addAnnotatedClass(Employee.class);
cfgg.configure("hibernate.cfg.xml");
newSchemaExport(cfgg);
System.out.println("Created");
SessionFactory ss=cfgg.buildSessionFactory();
org.hibernate.Session ses =ss.getCurrentSession();
ses.beginTransaction();
Employee ee= new Employee();
ee.setId(100);
ee.setNames("Sandeep");
ses.save(ee);
ses.getTransaction();
ses.close();
}
}
> java.sql.SQLException: No suitable driver found for jdbc:sqlserver://localhost:1433/tempdb
> ------------------------------------------------------------------------------------------
>
> Key: HBX-1190
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1190
> Project: Hibernate Tools
> Issue Type: Bug
> Components: eclipse
> Affects Versions: 3.2.4 Beta1
> Environment: Java SE 6/MS SQL 2005, Hibernate 3.0
> Reporter: Sandeep M
> Priority: Minor
> Labels: MSSQL2005, hibernate
> Original Estimate: 56h
> Remaining Estimate: 56h
>
> Dear All,
> I am unable to implement hibernate for MS SQL 2005. Lot of errors.
> I have added proper sql jar files from microsoft.
> Please help me in impementing my application.
> - regards
> Sandeep M
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list