Hello,
So I am having issues trying to convert XML into Java for a connection. Below is my code. I was wondering if anyone could help me figure it out.
Here is the XML FIle.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.SQLServer2012Dialect</property>
<property name="hibernate.connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
<property name="hibernate.connection.url">jdbc:sqlserver://sedb.database.windows.net:1433; </property>
<property name="hibernate.connection.database">test1</property>
<property name="hibernate.connection.username">test@test</property>
<property name="hibernate.connection.password">123456789</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.hbm2ddl.auto">update</property>
DB
<mapping class="main.S"/>
<mapping class="main.C"/>
<mapping class="main.D"/>
<mapping class="main.P"/>
<mapping class="main.E"/>
</session-factory>
</hibernate-configuration>
Here is my attempt at converting.
try
{
String host = "jdbc:sqlserver://sedb.database.windows.net:1433/test1";
String uName = "test@test";
String uPass = "123456789";
Connection con = DriverManager.getConnection(host,uName,uPass);
}
catch (Exception err)
{
System.out.println("Error");
}
As you can see Im quite new to this. Any pointers would help.
Thanks!