Page 1 of 1
MS SQL SFS Unity3D Config.xml help needed
Posted: 11 Jun 2009, 15:49
by JalenBlade
Hi everyone,
I'm new to SFS and Unity 3D and have some basic configuration issues to get through. Any help is greatly appreciated!
The docs contain info on how to connect to a MSAccess database and a MySQL database but no examples for a MS SQL database which is what I have. Does anyone know what to put in the following spots?
<Driver>sun.jdbc.odbc.JdbcOdbcDriver</Driver>
<ConnectionString>jdbc:odbc:sfsTest</ConnectionString>
<TestSQL><![CDATA[SELECT COUNT(*) FROM contacts]]></TestSQL>
Also, I'm looking for info on how to set up a sign-up screen and log-in screen once connected to the database. I'm loving this SFS and Unity 3D! Can't wait to get the basic structures in place so I can begin level design!
Posted: 11 Jun 2009, 19:02
by Lapo
<Driver>sun.jdbc.odbc.JdbcOdbcDriver</Driver>
This line specifies the Driver to use.
As specified in the documentation you can use the native ODBC driver if your DB supports it (MS SQL should definitely support ODBC) or use the native JDBC driver provided by the database vendor.
SmartFoxServer uses standard JDBC so further instructions on how to use the database specific driver are going to be found on your database website.
<ConnectionString>jdbc:odbc:sfsTest</ConnectionString>
This is the connection string.
If you use ODBC the last name (sfsTest) is the DSN (data source name), otherwise follow the docs provided with the JDBC driver.
<TestSQL><![CDATA[SELECT COUNT(*) FROM contacts]]></TestSQL
This is a simple test query that allows the Server to check if the database connection works and if it can execute queries on an existing table.
Also, I'm looking for info on how to set up a sign-up screen and log-in screen once connected to the database.
We provide login examples in our documentation. They are based on a Flash client but the server side part is identical no matter what client side technology you use, so you can follow those examples for the server side part.
See chapter 8 of the docs:
http://www.smartfoxserver.com/docs/
Also check the Java Extension Cookbook:
http://www.smartfoxserver.com/docs/docP ... okBook.htm
There are "Login recipes"
Posted: 11 Jun 2009, 22:58
by JalenBlade
so then...
<Driver>odbc</Driver>
<ConnectionString>odbc:myDatabaseName</ConnectionString>
<TestSQL><![CDATA[SELECT COUNT(*) FROM mytableName]]></TestSQL>
should work?
EDIT: It doesn't...Ive tried a hundred combinations and consulted multiple web sites concerning connection strings for MS SQL but nothing I've tried works. I keep getting various errors mainly "Data source not found and no default driver specified."
My file looks like this at the moment.
<Driver>sun.jdbc.odbc.JdbcOdbcDriver</Driver>
<ConnectionString>jdbc:odbc:myDatabaseName</ConnectionString>
<UserName>myUsername</UserName>
<Password>myPassword</Password>
<TestSQL>select * from items</TestSQL>
I know it's something simple but grrrr....lol
If anyone else is using MS SQL and could copy/paste the segment from your config.xml file it would save me countless hours!
Thanks in advance for any help!
Posted: 12 Jun 2009, 05:45
by Lapo
Sorry but I have never used the MS database so I don't think I can help much here. Anyways setting up an ODBC connections is usually pretty simple
1) Setup the DSN on the DB machine
2) Connect to it
Have you done step 1?
Posted: 12 Jun 2009, 08:32
by mhdside
Jalen, I`m using an MS SQL Server db, I had some trouble like you but finally I got it to work, as Lapo said you should setupt a DSN for your db on the machine where the db exists, to do this:
Control Panel > Administrative tools > Data Sources (ODBC) > User DSN > add... > you should be able to move from there...
then in the config
Code: Select all
<DatabaseManager active="true">
<Driver>sun.jdbc.odbc.JdbcOdbcDriver</Driver>
<ConnectionString>jdbc:odbc:[your dsn name]</ConnectionString>
<UserName>[db username]</UserName>
<Password>[db password]</Password>
<TestSQL><![CDATA[SELECT COUNT(*) FROM Users]]></TestSQL>
<MaxActive>10</MaxActive>
<MaxIdle>10</MaxIdle>
<OnExhaustedPool>fail</OnExhaustedPool>
<BlockTime>5000</BlockTime>
</DatabaseManager>
hope that helps.
Posted: 12 Jun 2009, 12:26
by JalenBlade
Awesome! Worked beautifully and no more hair loss! I knew there had to be a simple step I was missing somewhere.
Does anyone have any experience setting up sign-up and login screens?
I'd be willing to pay someone to get that part out of the way so I can move on to creating the game.
Thanks gentlemen!
Re: MS SQL SFS Unity3D Config.xml help needed
Posted: 14 Jul 2021, 08:49
by shive_1807
Hey I am integrating aws rds ms sql with smart fox server and has downloaded the jdbc jre file and place it in root/extension/__lib__ folder.
Now I have no idea about the driver class and the connection string for ms sql a little guidance will be highly appreciated.
Re: MS SQL SFS Unity3D Config.xml help needed
Posted: 15 Jul 2021, 14:56
by Lapo
Hi,
at this page:
https://docs.microsoft.com/en-us/sql/co ... a-database
they show how to build the connection string.
Cheers