|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Connection string syntax for SQLExpress
#!perl
What is the syntax for connection string using SQLExpress, and do I need any other modules? I am currently using mysql db, but trying to convert all CGI/perl code over to sqlexpress 05. I am a noob, please help. Here is my current string: $dbh = DBI->connect("DBI:mysql:database=" . dbconnect("Database") . ";host=" . dbconnect("Server"),dbconnect("DB_User"), dbconnect("DB_Password"),{'RaiseError' => 1}) JOhn |
|
#2
|
||||
|
||||
|
sql express 05 is effectively Microsoft's SQL server, you do know that there's a limit of 4GB's of data for a SQL server Express database?
__________________
--Ax without exception, there is no rule ... The great thing about Object Oriented code is that it can make small, simple problems look like large, complex ones ![]() 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0 Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. -- Jamie Zawinski |
|
#3
|
|||
|
|||
|
Quote:
Yes i knew that. I am simply trying to modify the string. I belive i just have to replace mysql with sqlexpress, but i wanted to ask to be sure. I may have other issues causing my app to not be able to change the dB. I want to be sure im using the correct syntax to connect to my dB. |
|
#4
|
|||
|
|||
|
Quote:
BTW...regex is awsome... ![]() |
|
#5
|
|||
|
|||
|
CGI_Schneid, you also need DBD::ODBC to support ODBC sql server...
Code:
use DBI;
use DBD::ODBC;
my $dbh = DBI->connect("dbi:ODBC:Driver={SQL Server};Server=<servername>;Database=<database_name>;", <username>, <password>, { 'PrintError' => 1, 'RaiseError' => 1 });
__________________
"Badges? We ain't got no badges. We don't need to badges! I don't have to show you any stinkin' badges!!" |
|
#6
|
|||
|
|||
|
Quote:
My problem iswhat to put for {SQL Server} and im not sure if in this string you typed, I should be putting MSSQL or SQLEXPRESS or LOCALHOST. I am not familliar witht the syntax. Please help. ![]() |
|
#7
|
|||
|
|||
|
The driver type for for SQL Server AND SQL Server Express should be set to "SQL Server" (as shown), so you put exactly what I have put, with the exception of the variables within "<", ">" obviously you set them as appropriate to your environment.
|
|
#8
|
||||
|
||||
|
Code:
my $dbh = DBI->connect(
"dbi:ODBC:Driver={SQL Server};Server=servername;Database=database_name;",
"username",
"password", { 'PrintError' => 1, 'RaiseError' => 1 });
Change the bits in red ... |
|
#9
|
|||
|
|||
|
Quote:
Thanks to both of you for your help. It has worked and saved me quite a bit of trouble. I should also point out to anyone reading this who is also a noob, you must also configure the ODBC driver. It is not very complicated but you must do it to have your conncetion work. I created one for system and one for user, i may not need them both but my configuration is a little different. Thanks for your help. This is a great forum with a wealth of information. Very valuable to those who want to stay employed!! JOhn |
|
#10
|
|||
|
|||
|
Quote:
One additional point of interest is that any time you change between MySQL and SQL or SQLExpress, check your sql statement syntax. Query language is not exactly the same, even though you might expect it to be. I was getting additional errors after i applied this connection string but they were steming from the sql statements. FYI. ![]() |
|
#11
|
||||
|
||||
|
you're not the first, it's unlikely you'll be the last ... don't sweat, but clues are good ... if you comply to ANSI SQL statements, you should be good, but it's nice to know what's on offer at market
![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > Connection string syntax for SQLExpress |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|